Verified
Status Update
Comments
yb...@google.com <yb...@google.com> #2
Forgot to paste the exception that was thrown:
No destination with route subGraph is on the NavController's back stack. The current destination is Destination(0xe5901274) route=a
cc...@google.com <cc...@google.com> #3
This is still happening with navigation-compose 2.4.0-alpha06
cc...@google.com <cc...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit d7af5243adb70d92a0104005ff353c83933c97ed
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Aug 23 22:03:09 2021
Ensure NavGraph Navigators are destroyed properly
When navigating with transitions, we properly hold destination entries
until the transition completes, but not for NavGraph entries. This is a
particular issue for popping since it results in NavGraph entries will
be moved to DESTROYED before their child destinations.
We need to make NavGraph back stack entries keep the maximum lifecycle
state of all of the entries in the graph. This means that as long as one
entry in the graph is CREATED, the graph itself will be CREATED and only
after all entries have been DESTROYED, will the NavGraph entry also be
destroyed.
RelNote: "Using getBackStackEntry and previousBackStackEntry inside
composable(), in conjuction with remember() will no longer cause an
exception for no destination being on the back stack."
Test: add new test
Bug: 194313238
Change-Id: I75138d24d27dac83b5301507161578ac811454e3
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryLifecycleTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
https://android-review.googlesource.com/1806636
Branch: androidx-main
commit d7af5243adb70d92a0104005ff353c83933c97ed
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Aug 23 22:03:09 2021
Ensure NavGraph Navigators are destroyed properly
When navigating with transitions, we properly hold destination entries
until the transition completes, but not for NavGraph entries. This is a
particular issue for popping since it results in NavGraph entries will
be moved to DESTROYED before their child destinations.
We need to make NavGraph back stack entries keep the maximum lifecycle
state of all of the entries in the graph. This means that as long as one
entry in the graph is CREATED, the graph itself will be CREATED and only
after all entries have been DESTROYED, will the NavGraph entry also be
destroyed.
RelNote: "Using getBackStackEntry and previousBackStackEntry inside
composable(), in conjuction with remember() will no longer cause an
exception for no destination being on the back stack."
Test: add new test
Bug: 194313238
Change-Id: I75138d24d27dac83b5301507161578ac811454e3
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryLifecycleTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
cc...@google.com <cc...@google.com> #5
This has been fixed internally and will be available in the Navigation 2.4.0-alpha08
release.
This also includes a lint check to ensure you surround any calls to getBackStackEntry
within composition with a remember
, which you should always be doing anyway, and that is the only way this actually works.
Description
Builders are not meant to be extended. Leaving the class open to extension adds ambiguity to the API.
Consider making this public class final.