Skip to content

feat(compose): Add keys to all LazyColumn and LazyVerticalGrid instances#212

Merged
theovilardo merged 1 commit intomasterfrom
feature/add-lazycolumn-keys
Oct 9, 2025
Merged

feat(compose): Add keys to all LazyColumn and LazyVerticalGrid instances#212
theovilardo merged 1 commit intomasterfrom
feature/add-lazycolumn-keys

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

This change improves UI performance and stability by providing a unique and stable key for every item in all LazyColumn and LazyVerticalGrid components throughout the application.

Following Jetpack Compose best practices, this helps the recomposer efficiently identify and manage list items, preventing unnecessary recompositions and state loss during list updates.

  • For dynamic lists of data (songs, albums, artists, etc.), a unique identifier from the data model (e.g., item.id) is used as the key.
  • For static items like headers, footers, or spacers, a descriptive and unique string literal is used as the key.

This change improves UI performance and stability by providing a unique and stable `key` for every item in all `LazyColumn` and `LazyVerticalGrid` components throughout the application.

Following Jetpack Compose best practices, this helps the recomposer efficiently identify and manage list items, preventing unnecessary recompositions and state loss during list updates.

- For dynamic lists of data (songs, albums, artists, etc.), a unique identifier from the data model (e.g., `item.id`) is used as the key.
- For static items like headers, footers, or spacers, a descriptive and unique string literal is used as the key.
@theovilardo theovilardo merged commit 48a7897 into master Oct 9, 2025
@theovilardo theovilardo deleted the feature/add-lazycolumn-keys branch October 16, 2025 18:04
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