Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Clean up popUpTo docs
Expand for full commit details
Clean up popUpTo docs
Fixing popUpTo docs to ensure the specify when you can expect the
popUpTo id to match the state that was saved internally.
Test: ./gradlew bOS
Bug: 216693019
Change-Id: I0afed497770d5ffb9b73be23933c5fba7aef8db3
Files:
- M
navigation/navigation-common/src/androidMain/kotlin/androidx/navigation/NavOptions.android.kt
- M
navigation/navigation-common/src/androidMain/kotlin/androidx/navigation/NavOptionsBuilder.android.kt
Hash: d2463ce033b1ccde579c0db746b9322a1ba46f80
Date: Sat Feb 01 01:03:34 2025
jb...@google.com <jb...@google.com>
pr...@google.com <pr...@google.com> #3
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-common:2.9.0-alpha06
androidx.navigation:navigation-common-android:2.9.0-alpha06
androidx.navigation:navigation-common-desktop:2.9.0-alpha06
androidx.navigation:navigation-common-iosarm64:2.9.0-alpha06
androidx.navigation:navigation-common-iossimulatorarm64:2.9.0-alpha06
androidx.navigation:navigation-common-iosx64:2.9.0-alpha06
androidx.navigation:navigation-common-linuxarm64:2.9.0-alpha06
androidx.navigation:navigation-common-linuxx64:2.9.0-alpha06
androidx.navigation:navigation-common-macosarm64:2.9.0-alpha06
androidx.navigation:navigation-common-macosx64:2.9.0-alpha06
androidx.navigation:navigation-common:2.8.7
Description
Component used: Navigation
Version used: 2.4.0
Devices/Android versions reproduced on: This is a documentation issue rather than a software issue.
If this is a bug in the library, we would appreciate if you could attach:
The documentation for NavOptions.shouldPopUpToSaveState() and NavOptions.Builder.setPopUpTo() both mention that in order to restore state, the restore ID must be "the same ID as popUpToId (note: this matching ID is true whether isPopUpToInclusive is true or false)."
The documentation is a bit confusing and what it says is not always the case. To quote Ian Lake, "what actually happens is that the saved state is associated with a particular ID. The saved state of an ID is restored when you navigate to that ID with restoreState as true. The tricky part is the inclusive flag on popUpTo. Ideally the ID that the saved state is saved under is the ID of the last destination you pop. I.e., if you have A -> B -> C and you popUpTo A with inclusive as false, the state would be saved under the ID of B And while we do always do that (save the state under the ID of the last thing popped), we also need to do one other thing - we save the state under the ID that you passed to popUpTo. This is how you can actually get back to the first saved state"
This part of the documentation should be removed entirely or updated to reflect how things actually work.