Assign keys for global search rows based on source

Maybe fixes #8924
This commit is contained in:
arkon 2023-01-15 10:14:28 -05:00
parent 5b5eb92184
commit e468554fd9
2 changed files with 8 additions and 8 deletions

View File

@ -81,16 +81,13 @@ fun GlobalSearchContent(
contentPadding = contentPadding,
) {
items.forEach { (source, result) ->
item {
item(key = source.id) {
GlobalSearchResultItem(
title = source.name,
subtitle = LocaleHelper.getDisplayName(source.lang),
onClick = { onClickSource(source) },
) {
when (result) {
is SearchItemResult.Error -> {
GlobalSearchErrorResultItem(message = result.throwable.message)
}
SearchItemResult.Loading -> {
GlobalSearchLoadingResultItem()
}
@ -114,6 +111,9 @@ fun GlobalSearchContent(
onLongClick = onLongClickItem,
)
}
is SearchItemResult.Error -> {
GlobalSearchErrorResultItem(message = result.throwable.message)
}
}
}
}

View File

@ -79,16 +79,13 @@ fun MigrateSearchContent(
contentPadding = contentPadding,
) {
items.forEach { (source, result) ->
item {
item(key = source.id) {
GlobalSearchResultItem(
title = if (source.id == sourceId) "${source.name}" else source.name,
subtitle = LocaleHelper.getDisplayName(source.lang),
onClick = { onClickSource(source) },
) {
when (result) {
is SearchItemResult.Error -> {
GlobalSearchErrorResultItem(message = result.throwable.message)
}
SearchItemResult.Loading -> {
GlobalSearchLoadingResultItem()
}
@ -105,6 +102,9 @@ fun MigrateSearchContent(
onLongClick = onLongClickItem,
)
}
is SearchItemResult.Error -> {
GlobalSearchErrorResultItem(message = result.throwable.message)
}
}
}
}