🚷 Improve navigation flow

Additional functions called to improve the navigation. The improvements
are:
- Avoid navigating to the same place if it's already on top
- Save and restore state for the TopLevel destinations
This commit is contained in:
Igor Escodro
2025-01-18 17:27:32 -05:00
parent b9bcd7f98f
commit 7cde151006

View File

@ -49,13 +49,18 @@ private fun NavigationLoader(
is TopLevel -> {
navHostController.navigate(destination) {
popUpTo(navHostController.graph.findStartDestination().id)
popUpTo(navHostController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
}
else -> {
navHostController.navigate(destination)
navHostController.navigate(destination) {
launchSingleTop = true
}
}
}
}