Luis Daivid
10/28/2022, 2:40 PMLuis Daivid
10/28/2022, 2:42 PMfun navigateToTopLevelDestination(topLevelDestination: TopLevelDestination) {
trace("Navigation: ${topLevelDestination.name}") {
val topLevelNavOptions = navOptions {
// Pop up to the start destination of the graph to
// avoid building up a large stack of destinations
// on the back stack as users select items
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
// Avoid multiple copies of the same destination when
// reselecting the same item
launchSingleTop = true
// Restore state when reselecting a previously selected item
restoreState = true
}
when (topLevelDestination) {
FOR_YOU -> navController.navigateToForYou(topLevelNavOptions)
...
}
}
}
Pedro Alberto
10/28/2022, 2:47 PMLuis Daivid
10/28/2022, 2:52 PMPedro Alberto
10/28/2022, 3:00 PMStylianos Gakis
10/28/2022, 3:24 PMStylianos Gakis
10/28/2022, 3:26 PMInt
and rememberSaveable solves this problem. Can you check if you can do the same for the data of the map which is being lost as you’re describing?