perf: Add stable keys to Lazy list items for performance (#323)
Added stable `key` parameters to `items(...)` and `itemsIndexed(...)` calls across 13 screens. This prevents Compose from treating all list mutations as full item replacements and eliminates unnecessary full list recompositions during state updates. Modifications applied to: - KeysScreen.kt, SharedComponents.kt, AchievementsScreen.kt, PluginsScreen.kt - SessionsScreen.kt, CronJobsScreen.kt, McpServersScreen.kt, PairingScreen.kt - ToolsetsScreen.kt, ChatScreen.kt, ModelScreen.kt, SkillsScreen.kt - KanbanScreen.kt, ProfilesScreen.kt, WebhooksScreen.kt Note: LogsScreen.kt was left without a key because logs are string lines that can be duplicated, and using `.hashCode()` would cause a "Key was already used" crash. Positional indexing is safer there. Fixes #279
This commit is contained in:
15 files changed
+17
-17
No files matched your search
@@ -149,7 +149,7 @@ fun KanbanScreen(
|
||||
contentPadding = PaddingValues(16.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||
) {
|
||||
items(state.columns) { column ->
|
||||
items(state.columns, key = { it.name }) { column ->
|
||||
val colName = column.name
|
||||
val colTasks =
|
||||
filteredTasks.filter {
|
||||
@@ -178,7 +178,7 @@ fun KanbanScreen(
|
||||
modifier = Modifier.weight(1f),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
items(colTasks) { task ->
|
||||
items(colTasks, key = { it.id }) { task ->
|
||||
TaskCard(
|
||||
task = task,
|
||||
onMoveLeft =
|
||||
|
||||
Reference in new issue
Block a user