Use more unique item keys

Should make stacktraces more distinguishable.
This commit is contained in:
arkon 2022-09-26 17:23:04 -04:00
parent f4c684b4b8
commit e90b39b29d
7 changed files with 13 additions and 13 deletions

View File

@ -109,19 +109,19 @@ private fun ExtensionContent(
) {
items(
items = state.items,
key = {
when (it) {
is ExtensionUiModel.Header.Resource -> it.textRes
is ExtensionUiModel.Header.Text -> it.text
is ExtensionUiModel.Item -> it.key()
}
},
contentType = {
when (it) {
is ExtensionUiModel.Item -> "item"
else -> "header"
}
},
key = {
when (it) {
is ExtensionUiModel.Header.Resource -> it.textRes
is ExtensionUiModel.Header.Text -> it.text
is ExtensionUiModel.Item -> "extension-${it.key()}"
}
},
) { item ->
when (item) {
is ExtensionUiModel.Header.Resource -> {

View File

@ -112,7 +112,7 @@ private fun MigrateSourceList(
items(
items = list,
key = { (source, _) -> source.id },
key = { (source, _) -> "migrate-${source.id}" },
) { (source, count) ->
MigrateSourceItem(
modifier = Modifier.animateItemPlacement(),

View File

@ -86,7 +86,7 @@ private fun SourcesFilterContent(
key = {
when (it) {
is FilterUiModel.Header -> it.hashCode()
is FilterUiModel.Item -> it.source.key()
is FilterUiModel.Item -> "source-filter-${it.source.key()}"
}
},
) { model ->

View File

@ -95,7 +95,7 @@ private fun SourceList(
key = {
when (it) {
is SourceUiModel.Header -> it.hashCode()
is SourceUiModel.Item -> it.source.key()
is SourceUiModel.Item -> "source-${it.source.key()}"
}
},
) { model ->

View File

@ -28,7 +28,7 @@ fun CategoryContent(
) {
itemsIndexed(
items = categories,
key = { _, category -> category.id },
key = { _, category -> "category-${category.id}" },
) { index, category ->
CategoryListItem(
modifier = Modifier.animateItemPlacement(),

View File

@ -645,7 +645,7 @@ private fun LazyListScope.sharedChapterItems(
) {
items(
items = chapters,
key = { it.chapter.id },
key = { "chapter-${it.chapter.id}" },
contentType = { MangaScreenItem.CHAPTER },
) { chapterItem ->
val haptic = LocalHapticFeedback.current

View File

@ -93,7 +93,7 @@ fun LazyListScope.updatesUiItems(
key = {
when (it) {
is UpdatesUiModel.Header -> it.hashCode()
is UpdatesUiModel.Item -> it.item.update.chapterId
is UpdatesUiModel.Item -> "updates-${it.item.update.chapterId}"
}
},
) { item ->