Hi, we’re getting a few `java.lang.IllegalArgument...
# compose
m
Hi, we’re getting a few
java.lang.IllegalArgumentException
No destination with route "A" is on the NavController's back stack. The current destination is a route ="B"
while trying to access
public fun getBackStackEntry(route: String): NavBackStackEntry
to scope our sharedViewModel.
Copy code
composable("A"){
 ScreenA(hiltViewModel(it)
}

composable("B){
 val parentNavBackStack = remember { navController.getBackStackEntry("A") }
 ScreenB (hiltViewModel(parentNavBackStackEntry))
}
It literally feels like we covered all the necessary steps and I’m totally clueless about what else I can do to fix this. Both screens are inside the same navGraph and usually work without any issues. Is this an issue with the navigation component? Crashes happen on the following devices:
Copy code
1. Huawei Mate 20 lite Android 10
2. Realme 7 Pro Android 11
2
i
Use
remember(it) {
instead of just
remember
, see https://issuetracker.google.com/issues/227382831 for updating the Lint check
👍 4