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(
items = state.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 = { contentType = {
when (it) { when (it) {
is ExtensionUiModel.Item -> "item" is ExtensionUiModel.Item -> "item"
else -> "header" else -> "header"
} }
}, },
key = {
when (it) {
is ExtensionUiModel.Header.Resource -> it.textRes
is ExtensionUiModel.Header.Text -> it.text
is ExtensionUiModel.Item -> "extension-${it.key()}"
}
},
) { item -> ) { item ->
when (item) { when (item) {
is ExtensionUiModel.Header.Resource -> { is ExtensionUiModel.Header.Resource -> {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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