Status Update
Comments
su...@google.com <su...@google.com>
ap...@google.com <ap...@google.com> #2
I suspect this change is the culprit.
su...@google.com <su...@google.com> #3
Bug reproducible in compose NavHost when compose sets same graph consecutively.
Upon setting same graph the second time, the original _graph
nodes were not properly replaced by the new graph
node instances. When navigating to new destination in addEntryToBackstack
:
findDestination(destination.id)
was not able to find destination node (a new instance) amongst the old nodes (old instances). Therefore it proceeds to re-add new node's hierarchy resulting in duplicated root node.
The fix to
hu...@gmail.com <hu...@gmail.com> #4
Branch: androidx-main
commit 5499d88b63726e63900b89d3100be1b3a17b84ce
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 28 17:00:19 2023
Fix set same graph to replace old destinations
When setting the same graph (exact same routes and destinations but different instances), NavController would keep the original graph but replace the existing graph's nodes with the new graph's nodes. Fix the replace logic to ensure this replacement happens. Also replace backqueue's entry destinations with new instances to ensure the graph and backstack is in sync.
Test: ./gradlew navigation:navigation-compose:cC
Bug: 275258161
Bug: 275407804
Relnote: "When NavController sets the same graph with same route and destinations, it now properly replaces its current graph nodes and its bacstack destinations with new instances."
Change-Id: I5bc582e315578ee53383596070ee3ea4a23aed69
M navigation/navigation-compose/build.gradle
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
su...@google.com <su...@google.com> #5
Fixed internally and will be available navigation 2.6.0-alpha09
Description