From 7fd19758a4b96a0bd21e364bacb35502eba9ed8e Mon Sep 17 00:00:00 2001 From: Seb3thehacker Date: Sun, 8 Nov 2026 21:29:12 -0800 Subject: [PATCH] The music browser no longer crashes when an app lists the same item twice --- .../main/java/app/seb3thehacker/gearslip/car/MediaBrowse.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaBrowse.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaBrowse.kt index 122e878..4878c30 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaBrowse.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaBrowse.kt @@ -120,7 +120,9 @@ internal fun BrowsePanel(browse: app.seb3thehacker.gearslip.media.BrowseState, m */ @Composable private fun BrowseList(entries: List, media: CarMedia) { - val sections = remember(entries) { browseSections(entries) } + // A list's keys must be unique, and some apps list the same item twice (Music Assistant's + // playlists, issue #90): the repeat would do the same thing anyway, so it's dropped. + val sections = remember(entries) { browseSections(entries.distinctBy { it.id }) } BoxWithConstraints(Modifier.fillMaxSize()) { val onlyGrid = sections.size == 1 && sections[0].grid && sections[0].heading == null val columns = ((maxWidth + SHELF_GAP) / (SHELF_COVER + SHELF_GAP)).toInt().coerceAtLeast(2) @@ -243,7 +245,7 @@ internal fun QueuePanel(queue: List, now: NowPlaying, media: CarMedi contentPadding = PaddingValues(bottom = 8.dp), verticalArrangement = Arrangement.spacedBy(8.dp), ) { - items(upNext, key = { it.queueId }) { track -> QueueRow(track, media) } + items(upNext.distinctBy { it.queueId }, key = { it.queueId }) { track -> QueueRow(track, media) } } } }