Skip to content

Commit

Permalink
fix(artist song): update selection when songs change
Browse files Browse the repository at this point in the history
  • Loading branch information
z-huang committed Sep 1, 2024
1 parent ef0b389 commit 948c1b8
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
Expand All @@ -40,6 +41,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEachReversed
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.zionhuang.music.LocalPlayerAwareWindowInsets
Expand Down Expand Up @@ -108,6 +110,14 @@ fun ArtistSongsScreen(
BackHandler(onBack = onExitSelectionMode)
}

LaunchedEffect(songIndex) {
selection.fastForEachReversed { songId ->
if (songIndex[songId] == null) {
selection.remove(songId)
}
}
}

Box(
modifier = Modifier.fillMaxSize()
) {
Expand Down

0 comments on commit 948c1b8

Please sign in to comment.