diff --git a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/showcases/layouts/OptimizedStory.kt b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/showcases/layouts/OptimizedStory.kt index d8364fdd0..0aaf08e7e 100644 --- a/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/showcases/layouts/OptimizedStory.kt +++ b/pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/showcases/layouts/OptimizedStory.kt @@ -54,9 +54,8 @@ import kotlin.time.Duration.Companion.seconds fun OptimizedStory(storyViewModel: StoryViewModel = viewModel()) { val mediaItems = storyViewModel.mediaItems val pagerState = rememberPagerState { mediaItems.size } - - LaunchedEffect(pagerState.currentPage) { - storyViewModel.setActivePage(pagerState.currentPage) + LaunchedEffect(pagerState.settledPage) { + storyViewModel.setActivePage(pagerState.settledPage) } Box(modifier = Modifier.fillMaxSize()) {