Vaibhav Jaiswal
12/17/2023, 3:22 PMrememberLazyListState()
• ViewPager State is lost (I’m using rememberPagerState()
• All Launched Effects of all Composables run again (LaunchedEffect(Unit)
)
• Compose States reset to their default value for a small amount of time, then get back to original value
As of now, I’ve been using a workaround, i.e. to store lazyListState, viewPager State in ViewModel, which I dont think is right
Does anyone know, if this is the default behaviour of Compose, or its Voyager’s Navigation issue?
Cc: @लातों वाला भूतArkadii Ivanov
12/17/2023, 4:00 PMArkadii Ivanov
12/17/2023, 4:01 PMVaibhav Jaiswal
12/17/2023, 5:19 PMArkadii Ivanov
12/17/2023, 6:07 PMSuresh Maidaragi
12/18/2023, 4:24 AMArkadii Ivanov
12/18/2023, 7:57 AMremember
-ed values are lost, as a screen Composable exits the composition when another screen is pushed to the stack. But the screen Composable should correctly restore its state, r.g. LazyColumn is able to keep its scroll position. Make sure you keep your screen data in a ViewModel (or whatever concept is provided by the navigation library).Vaibhav Jaiswal
12/18/2023, 8:01 AMArkadii Ivanov
12/18/2023, 8:06 AMVaibhav Jaiswal
12/18/2023, 8:07 AMArkadii Ivanov
12/18/2023, 8:08 AMArkadii Ivanov
12/18/2023, 8:09 AMVaibhav Jaiswal
12/18/2023, 8:11 AMArkadii Ivanov
12/18/2023, 8:14 AMremember
-ed state is lost when another screen is pushed to the stack, all `LaunchedEffect`s are terminated, etc. But rememberSaveable
-ed state should be restored correctly (as long as there as no process death involved).