Fix language in source filter list jumping to top incorrectly

Fixes #9068
This commit is contained in:
arkon
2023-05-03 15:07:41 -04:00
parent 14c465d36f
commit f5ad95d78a
4 changed files with 28 additions and 20 deletions

View File

@@ -64,7 +64,7 @@ private fun SourcesFilterContent(
state.items.forEach { (language, sources) ->
val enabled = language in state.enabledLanguages
item(
key = language.hashCode(),
key = language,
contentType = "source-filter-header",
) {
SourcesFilterHeader(
@@ -74,18 +74,19 @@ private fun SourcesFilterContent(
onClickItem = onClickLanguage,
)
}
if (!enabled) return@forEach
items(
items = sources,
key = { "source-filter-${it.key()}" },
contentType = { "source-filter-item" },
) { source ->
SourcesFilterItem(
modifier = Modifier.animateItemPlacement(),
source = source,
enabled = "${source.id}" !in state.disabledSources,
onClickItem = onClickSource,
)
if (enabled) {
items(
items = sources,
key = { "source-filter-${it.key()}" },
contentType = { "source-filter-item" },
) { source ->
SourcesFilterItem(
modifier = Modifier.animateItemPlacement(),
source = source,
enabled = "${source.id}" !in state.disabledSources,
onClickItem = onClickSource,
)
}
}
}
}