Describe the bug
Trying to update SavedStateHandle which is accessible from NavBackStackEntry, and then read those values from a ViewModel which has a SavedStateHandle, and I see no values in there. Checked the instance ID and I see that ViewModel has different instance than a NavBackStackEntry. Question is how to get the same instance. I have a workaround which is working fine, but it would be nice to have it resolved and not jumping arround.
To Reproduce
make a composable navGraph with 2 routes. When navigating from route 1 to 2 update savedStateHandle the way like so:
Describe the bug Trying to update SavedStateHandle which is accessible from NavBackStackEntry, and then read those values from a ViewModel which has a SavedStateHandle, and I see no values in there. Checked the instance ID and I see that ViewModel has different instance than a NavBackStackEntry. Question is how to get the same instance. I have a workaround which is working fine, but it would be nice to have it resolved and not jumping arround.
To Reproduce make a composable navGraph with 2 routes. When navigating from route 1 to 2 update savedStateHandle the way like so:
backStackEntry.savedStateHandle[PRODUCT_FAMILY_NAME_PARAM] = "test data"
then inside a ViewModel try to read it like so
checkNotNull(savedStateHandle[PRODUCT_FAMILY_NAME_PARAM])
Expected behavior I should get a "test data" string but get nothing
Koin module and version:
koin-core:3.4.3
Snippet or Sample project to help reproduce Add a snippet or even a small sample project to hel reproduce your case.