Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-05-24 - Compose LazyColumn Performance
**Learning:** Found multiple instances of `LazyColumn` in `AiAssistantBottomSheet.kt` iterating over lists without providing a `key`. This causes unnecessary recompositions of all list items in Jetpack Compose when the underlying dataset changes (e.g., chat messages update).
**Action:** Added stable `key` identifiers to `items(chatMessages)`, `items(filteredHistory)`, and `items(allNotes)` to allow Jetpack Compose to efficiently track changes and avoid full list re-renders. Ensure `key` parameters are used for all dynamic lists in the future.
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ fun AiAssistantBottomSheet(
}
}

items(chatMessages) { msg ->
items(chatMessages, key = { msg -> "${msg.timestamp}_${msg.role}" }) { msg ->
val isUser = msg.role == "user"
val parsed = remember(msg.content) {
if (!isUser) GeminiActionParser.parse(msg.content) else ParsedAiMessage(msg.content, null)
Expand Down Expand Up @@ -1138,7 +1138,7 @@ fun AiAssistantBottomSheet(
.weight(1f),
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
items(filteredHistory) { item ->
items(filteredHistory, key = { item -> item.id }) { item ->
Card(
shape = RoundedCornerShape(16.dp),
colors = CardDefaults.cardColors(
Expand Down Expand Up @@ -1368,7 +1368,7 @@ fun AiAssistantBottomSheet(
)

LazyColumn(verticalArrangement = Arrangement.spacedBy(4.dp)) {
items(allNotes) { n ->
items(allNotes, key = { n -> n.id }) { n ->
val isTargeted = targetedNoteIds.contains(n.id)
Surface(
shape = RoundedCornerShape(12.dp),
Expand Down