File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
turbo/src/main/kotlin/dev/hotwire/turbo/nav Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,7 @@ internal class TurboNavGraphBuilder(
38
38
registeredActivities : List <KClass <out AppCompatActivity >>,
39
39
registeredFragments : List <KClass <out Fragment >>
40
40
): NavGraph {
41
- // Use a random number to start the nav graph, so the graph is unique every time
42
- // and it can be reset/recreated on-demand. Updating an existing nav graph with
43
- // an identical one would bypass recreating the nav stack from scratch.
44
- var currentRoute = Random .nextInt()
41
+ var currentRoute = 1
45
42
46
43
val activityDestinations = registeredActivities.map {
47
44
ActivityDestination (
@@ -95,6 +92,15 @@ internal class TurboNavGraphBuilder(
95
92
argument(" location" ) {
96
93
defaultValue = startLocation
97
94
}
95
+
96
+ // Use a random number to represent a unique instance of the graph, so the
97
+ // graph is unique every time. This lets it be reset/recreated on-demand from
98
+ // `TurboSessionNavHostFragment.reset()`. Replacing an existing nav graph with
99
+ // an identical one would bypass recreating the nav stack from scratch in
100
+ // `NavController.setGraph()`.
101
+ argument(" unique_instance" ) {
102
+ defaultValue = Random .nextInt()
103
+ }
98
104
}
99
105
}
100
106
You can’t perform that action at this time.
0 commit comments