You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val voyagerVersion ="1.0.0"
implementation("cafe.adriel.voyager:voyager-navigator:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-transitions:$voyagerVersion")
implementation("cafe.adriel.voyager:voyager-hilt:$voyagerVersion")
implementation("com.google.dagger:hilt-android:2.50")
kapt("com.google.dagger:hilt-android-compiler:2.50")
If we increment the counter a couple times, and then perform some configuration changes, it works as expected. The counter is kept and the handle has the correct state.
When process death happens, the navigator state is correct, but the ViewModel's SavedStateHandle is not saved, and the counter is reset to its initial value. Here's a recording of it: savedstatehandle.webm
Not sure if this has been reported in another issue, but I did not find anyone mentioning it. This is quite bothersome as we can't store the user's input in a screen across process death.
The text was updated successfully, but these errors were encountered:
It looks like it's caused by adding transition animations. Removing { navigator -> SlideTransition(navigator) } makes it restore the state correctly. Also even with transitions, after first process death the app starts already on Screen1, so incrementing counter again and triggering another process death makes it restore the state correctly. Navigating back and forward again causes the bug to reappear.
And it's unrelated to ViewModel, because the bug also happens if you use rememberSaveable.
In a Voyager screen with a
ViewModel
, if we set anything in theSavedStateHandle
it won't be restored when process death happens.Here's a demo project with the issue:
The Voyager & Hilt dependencies are:
If we increment the counter a couple times, and then perform some configuration changes, it works as expected. The counter is kept and the handle has the correct state.
When process death happens, the navigator state is correct, but the
ViewModel
'sSavedStateHandle
is not saved, and the counter is reset to its initial value. Here's a recording of it:savedstatehandle.webm
Not sure if this has been reported in another issue, but I did not find anyone mentioning it. This is quite bothersome as we can't store the user's input in a screen across process death.
The text was updated successfully, but these errors were encountered: