Skip to content

Commit

Permalink
🐛 FIX(UI): Use hashCode() for song keys in Library and Home screens t…
Browse files Browse the repository at this point in the history
…o prevent recomposition issues.
  • Loading branch information
maxrave-dev committed Jan 29, 2025
1 parent 53c84cc commit a252b84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ fun ChartData(
state = lazyListState1,
flingBehavior = snapperFlingBehavior1,
) {
items(chart.songs, key = { it.videoId }) {
items(chart.songs, key = { it.hashCode() }) {
ItemTrackChart(onClick = {
viewModel.setQueueData(
QueueData(
Expand Down Expand Up @@ -777,7 +777,7 @@ fun ChartData(
state = lazyListState,
flingBehavior = snapperFlingBehavior,
) {
items(chart.videos.items.size, key = { index -> chart.videos.items[index].videoId }) {
items(chart.videos.items.size, key = { index -> chart.videos.items[index].videoId + index }) {
val data = chart.videos.items[it]
ItemVideoChart(
onClick = {
Expand Down Expand Up @@ -819,7 +819,7 @@ fun ChartData(
) {
items(chart.artists.itemArtists.size, key = { index ->
val item = chart.artists.itemArtists[index]
item.title + item.browseId
item.title + item.browseId + index
}) {
val data = chart.artists.itemArtists[it]
ItemArtistChart(onClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fun LibraryDynamicPlaylistScreen(
LibraryDynamicPlaylistType.MostPlayed -> mostPlayed
else -> emptyList()
},
key = { it.videoId },
key = { it.hashCode() },
) { song ->
SongFullWidthItems(
songEntity = song,
Expand Down

0 comments on commit a252b84

Please sign in to comment.