minimise
minimise copied to clipboard
You should not use collectAsState for navigation
navigationManager.commands.collectAsState().value.also { command -> if (command.destination.isNotEmpty()) { navController.navigate(command.destination) } }
Can cause nullpointer exceptions on recomposition because the navgraph is not initialized yet. It shoudl be something like: LaunchedEffect(navigationManager.commands){ navigationManager.commands.collect{ command -> if (command.destination.isNotEmpty()) { navController.navigate(command.destination) } } }