@Composable invocations can only happen from the context of a @Composable function
a
Alexis
12/11/2024, 2:36 PM
I think that the the viewModel should be called either within
composable {}
either outside of
navigation<>() {}
.
g
Giorgi
12/11/2024, 5:49 PM
umm, I was looking for a way to scope ViewModel to the subgraph and share it between 4 screens...
Giorgi
12/11/2024, 5:49 PM
if I do outside, then it will stay alive forever
a
Alexis
12/11/2024, 5:56 PM
You can have other NavHost such as:
MasterNav {
• SignupNav (that'll correspond to the code that you've shared)
• Feature1Nav
}
The viewModel will then be scoped within the SignupNav.