File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
app/src/main/java/org/schabi/newpipe/compose/playlist Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ import androidx.compose.material3.MaterialTheme
1111import androidx.compose.material3.Surface
1212import androidx.compose.runtime.Composable
1313import androidx.compose.runtime.collectAsState
14+ import androidx.compose.runtime.derivedStateOf
1415import androidx.compose.runtime.getValue
16+ import androidx.compose.runtime.remember
1517import androidx.compose.ui.platform.LocalContext
1618import androidx.compose.ui.tooling.preview.Preview
1719import androidx.compose.ui.unit.dp
@@ -40,7 +42,11 @@ import org.schabi.newpipe.viewmodels.PlaylistViewModel
4042fun Playlist (playlistViewModel : PlaylistViewModel = viewModel()) {
4143 val playlistInfo by playlistViewModel.playlistInfo.collectAsState()
4244 val streams = playlistViewModel.streamItems.collectAsLazyPagingItems()
43- val totalDuration = streams.itemSnapshotList.sumOf { it!! .duration }
45+ val totalDuration by remember {
46+ derivedStateOf {
47+ streams.itemSnapshotList.sumOf { it!! .duration }
48+ }
49+ }
4450
4551 val context = LocalContext .current
4652 val onClick = { stream: StreamInfoItem ->
You can’t perform that action at this time.
0 commit comments