Hi all! I've got a question about Navigation with ...
# compose
f
Hi all! I've got a question about Navigation with Compose. I have a Drawer composable that is my main navigation component of the app. I'm using Koin to inject the viewModels. Whenever I select a drawer item the app navigates to my composable and the viewmodel is created, I can navigate forward to another screen within the feature and the viewmodel is retained as expected. However if I go to another drawer item and return to the previous screen the viewModel is not recreated leaving me with previous data on screen. Is there a way that I can reset composable and viewmodel whenever a Drawer menu item is clicked? This is how I navigate and my NavHost is pretty simple too.
n
Tried setting restoreState = false on the navOptions?
i
That seems all working as intended with multiple back stacks. Shouldn't your ViewModel already be delivering a stream of data that automatically updates when you go back to that screen? The whole idea of needing to "reset" the ViewModel means you've set your ViewModel and data layers up incorrectly