From 467729973996a1316bf59339214050b51b975108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaquim=20Sta=CC=88hli?= Date: Fri, 27 Sep 2024 13:58:37 +0200 Subject: [PATCH] Use settledPage instead --- .../pillarbox/demo/ui/showcases/layouts/OptimizedStory.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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()) {