Skip to content

Commit d1cc239

Browse files
committed
Use a random UUID instead of an Int
1 parent a98e6bc commit d1cc239

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

turbo/src/main/kotlin/dev/hotwire/turbo/nav/TurboNavGraphBuilder.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import androidx.navigation.fragment.FragmentNavigator
1212
import androidx.navigation.fragment.FragmentNavigatorDestinationBuilder
1313
import dev.hotwire.turbo.config.TurboPathConfiguration
1414
import dev.hotwire.turbo.config.uri
15-
import kotlin.random.Random
15+
import java.util.*
1616
import kotlin.reflect.KClass
1717
import kotlin.reflect.full.findAnnotation
1818
import kotlin.reflect.full.isSubclassOf
@@ -93,13 +93,13 @@ internal class TurboNavGraphBuilder(
9393
defaultValue = startLocation
9494
}
9595

96-
// Use a random number to represent a unique instance of the graph, so the
96+
// Use a random value to represent a unique instance of the graph, so the
9797
// graph is unique every time. This lets it be reset/recreated on-demand from
9898
// `TurboSessionNavHostFragment.reset()`. Replacing an existing nav graph with
9999
// an identical one would bypass recreating the nav stack from scratch in
100100
// `NavController.setGraph()`.
101101
argument("unique_instance") {
102-
defaultValue = Random.nextInt()
102+
defaultValue = UUID.randomUUID().toString()
103103
}
104104
}
105105
}

0 commit comments

Comments
 (0)