minimise icon indicating copy to clipboard operation
minimise copied to clipboard

You should not use collectAsState for navigation

Open bigfarid opened this issue 3 years ago • 0 comments

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) } } }

bigfarid avatar Nov 05 '21 15:11 bigfarid