From 440fa5716137a75a40214aa3a31c31312abec9f2 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Mon, 8 Jun 2026 20:19:58 +0200 Subject: [PATCH] fix(debug): use prefixed composite keys in LazyColumn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cal.id and Event.instanceId share a numeric range, and the LazyColumn keys both sections — colliding values (e.g. cal-id=4 + event-instance-id=4) crashed with "Key '4' was already used". Additionally, Instances._ID is inherited from the parent Event, so recurring events produce multiple rows with the same instanceId; the start instant disambiguates them. --- .../de/jeanlucmakiola/calendula/ui/debug/DebugScreen.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/calendula/ui/debug/DebugScreen.kt b/app/src/main/java/de/jeanlucmakiola/calendula/ui/debug/DebugScreen.kt index 2b5fc5f..7adbffa 100644 --- a/app/src/main/java/de/jeanlucmakiola/calendula/ui/debug/DebugScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/calendula/ui/debug/DebugScreen.kt @@ -97,7 +97,7 @@ private fun SuccessContent(state: DebugUiState.Success) { ) } } else { - items(state.calendars, key = { it.id }) { CalendarRow(it) } + items(state.calendars, key = { "cal-${it.id}" }) { CalendarRow(it) } } item { Spacer(Modifier.height(16.dp)) } @@ -111,7 +111,12 @@ private fun SuccessContent(state: DebugUiState.Success) { ) } } else { - items(state.nextEvents, key = { it.instanceId }) { EventRow(it) } + items( + state.nextEvents, + // Recurring events share Instances._ID across occurrences, so + // include the start instant to keep the LazyColumn key unique. + key = { "evt-${it.instanceId}-${it.start.toEpochMilliseconds()}" }, + ) { EventRow(it) } } } }