fix(debug): use prefixed composite keys in LazyColumn
All checks were successful
CI / ci (push) Successful in 9m35s
All checks were successful
CI / ci (push) Successful in 9m35s
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.
This commit is contained in:
@@ -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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user