mirror of
https://github.com/FluxaMedia/fluxa.git
synced 2026-08-14 19:25:01 +00:00
Fix Discover crash on scroll from duplicate grid item keys
Addon catalogs can return overlapping items across paginated skip offsets, so the discover results list could contain the same type:id twice. LazyVerticalGrid requires unique keys and crashed with IllegalArgumentException once a duplicate scrolled into view. Dedupe results in the coordinator where they're assigned.
This commit is contained in:
parent
83f452da15
commit
61e5b2bd52
1 changed files with 2 additions and 2 deletions
|
|
@ -94,7 +94,7 @@ internal class HomeHeadlessBrowseCoordinator(
|
|||
)
|
||||
)
|
||||
val state = result.state["discover"] as? Map<*, *>
|
||||
results.value = decodeList(state?.get("results"), metaListType)
|
||||
results.value = decodeList<Meta>(state?.get("results"), metaListType).distinctBy { "${it.type}:${it.id}" }
|
||||
resultSources.value = decodeObject(state?.get("resultSources"), sourceMapType) ?: emptyMap()
|
||||
} finally {
|
||||
loading.value = false
|
||||
|
|
@ -118,7 +118,7 @@ internal class HomeHeadlessBrowseCoordinator(
|
|||
)
|
||||
)
|
||||
val state = result.state["discover"] as? Map<*, *>
|
||||
val updated = decodeList<Meta>(state?.get("results"), metaListType)
|
||||
val updated = decodeList<Meta>(state?.get("results"), metaListType).distinctBy { "${it.type}:${it.id}" }
|
||||
val source = HomeCatalogSource(transportUrl, catalogId, contentType, genre)
|
||||
val sources = resultSources.value.toMutableMap()
|
||||
updated.forEach { item ->
|
||||
|
|
|
|||
Loading…
Reference in a new issue