diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt index 75a294c01..9a205ff4e 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt @@ -89,8 +89,11 @@ class NiaAppState( val currentTopLevelDestination: TopLevelDestination? @Composable get() { - return TopLevelDestination.entries.firstOrNull { topLevelDestination -> - currentDestination?.hasRoute(route = topLevelDestination.route) ?: false + val currentDestination = currentDestination + return remember(currentDestination) { + TopLevelDestination.entries.firstOrNull { topLevelDestination -> + currentDestination?.hasRoute(route = topLevelDestination.route) ?: false + } } }