From e468554fd9fbe19bfe58b4c018bd8ee87388bed7 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 15 Jan 2023 10:14:28 -0500 Subject: [PATCH] Assign keys for global search rows based on source Maybe fixes #8924 --- .../eu/kanade/presentation/browse/GlobalSearchScreen.kt | 8 ++++---- .../eu/kanade/presentation/browse/MigrateSearchScreen.kt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt index 5d240471ad..89d6f18791 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt @@ -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) + } } } } diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt index 069594e936..2a37557875 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSearchScreen.kt @@ -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) + } } } }