Skip to content

Commit 0da36c9

Browse files
committed
Add item's key to lazy columns
1 parent 0fd81c9 commit 0da36c9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

app/src/main/java/com/paulcoding/hviewer/ui/page/post/PostPage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fun PostPage(appViewModel: AppViewModel, goBack: () -> Unit) {
7373
state = listState,
7474
verticalArrangement = Arrangement.spacedBy(8.dp)
7575
) {
76-
items(uiState.images) { image ->
76+
items(uiState.images, key = { it }) { image ->
7777
HImage(
7878
modifier = Modifier.clickable { selectedImage = image },
7979
url = image

app/src/main/java/com/paulcoding/hviewer/ui/page/posts/PostsPage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fun PageContent(
160160
LazyColumn(
161161
state = listState
162162
) {
163-
items(uiState.postItems) { post ->
163+
items(uiState.postItems, key = { it.url }) { post ->
164164
PostCard(
165165
post,
166166
isFavorite = listFavorite.find { it.url == post.url } != null,

app/src/main/java/com/paulcoding/hviewer/ui/page/search/SearchPage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fun PageContent(
135135
LazyColumn(
136136
state = listState
137137
) {
138-
items(uiState.postItems) { post ->
138+
items(uiState.postItems, key = { it.url }) { post ->
139139
PostCard(post,
140140
isFavorite = listFavorite.find { it.url == post.url } != null,
141141
setFavorite = { isFavorite ->

0 commit comments

Comments
 (0)