Latest 0.22.1 `resetRoot(saveState = true, restoreState = true)` loses state when using `pop`
Opened this issue · 6 comments
Updating to newest 0.22.1
resetRoot(saveState = true, restoreState = true)
restores save states correctly but after reseting to a tab with a backstack size greater than 1 calling navigator.pop()
loses state on previous screens vs going back using gesture navigation which restores everything correctly.
Steps to reproduce in chrisbanes/tivi:
- Go to settings in discover (profile picture -> settings)
- Scroll to Open source licenses
- Scroll a bit for testing
- Switch to other tab
- Switch back to discover (scroll state is restored correctly)
- Going back using gesture navigation restores settings scroll correctly vs tapping back icon (or 2/3 system button back) which calls
pop
loses scroll position
I've just added a test for this in #1454 and everything seems to be working as expected. I can't reproduce this.
Are you seeing this on any particular device? Also, are you using rememberSaveable
or retained?
@chrisbanes just restested on api pre 34 and 34. Pre 34 everything looks okay but 34 seems to be the problem. Commenting out decoration
param on NavigableCircuitContent
seems to fix the issue on 34.
Unfortunately still seeing the issue. Here is a recording of the issue if that helps. Going back via gesture navigation works, but going back using the up arrow resets the scroll position.
Screen_recording_20240604_210457.webm
A state in the ui like rememberSaveable { mutableStateOf(int) }
restores fine from my testing but there's something up with rememberLazyListState
on api 34. Swapping GestureNavigationDecoration
to CupertinoGestureNavigationDecoration
or commeting decoration
all out fixes the scroll position issue.
Ah so this is UI state, rather than something in the Presenter
. I'll tweak the test and see what it does