https://kotlinlang.org logo
Title
u

user

07/08/2022, 11:31 AM
Why do I need to wrap navActions.navigateToPurchase() with LaunchedEffect in fun NavGraph when use Jetpack Compose? In my plan, I hope to display Home UI when I run an app first, a user can open Purchase UI by clicking a button on Home UI. And more, Purchase UI will be displayed automatically if the app is expired when I run the app first. In Code A, navActions.navigateToPurchase() is invoked in both fun NavGraph(...) and fun ScreenHome(...). The app will crash if I don't wrap navActions.navigateToPurchase() with LaunchedEffect in fun NavGraph(), why? You can see Error Logs below. Code A @Composable fun...