Skip to content

Add stable keys to LazyColumn/LazyRow items#62

Merged
chrisuthe merged 1 commit intomainfrom
fix/lazy-list-stable-keys
Mar 8, 2026
Merged

Add stable keys to LazyColumn/LazyRow items#62
chrisuthe merged 1 commit intomainfrom
fix/lazy-list-stable-keys

Conversation

@chrisuthe
Copy link
Copy Markdown
Owner

Summary

  • Added key lambdas to three items/itemsIndexed calls that were missing them, preventing unnecessary recomposition of every visible item on list changes.
  • NowPlayingHeadUnit: queue peek itemsIndexed now uses queueItemId as key.
  • SearchScreen: filter chip items now uses the media type enum name as key.
  • BrowseListScreen: sort chip items now uses the sort option enum name as key.

All other items/itemsIndexed calls across the codebase already had stable keys.

Test plan

  • Open the head unit Now Playing screen with a queue and verify up-next items render correctly
  • Change tracks and confirm the up-next list updates without visual glitches
  • Open the search screen, toggle filter chips, and verify correct selection state
  • Open the library browse screen and verify sort chips render and toggle correctly

Without stable keys, Compose recomposes every visible item when the
list changes. Add key lambdas to the three remaining items/itemsIndexed
calls that were missing them:

- NowPlayingHeadUnit: use queueItemId for up-next queue items
- SearchScreen: use media type name for filter chips
- BrowseListScreen: use sort option name for sort chips
@chrisuthe chrisuthe merged commit d30e54b into main Mar 8, 2026
@chrisuthe chrisuthe deleted the fix/lazy-list-stable-keys branch March 8, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant