I'd check what hiltViewModel does. If it were a simple function that returns an object it makes sense that it gets called repeatedly since there's nothing remembering it across recompositions.
f
Francesc
06/07/2022, 9:45 PM
the documentation reads "returns an existing viewmodel or creates a new one" so it should return the same instance each time as long as this block is in the composition
s
Stylianos Gakis
06/08/2022, 5:06 AM
Yeah I also see that in here it’s also used without remember or something like that. Not sure what it could be then.
m
myanmarking
06/08/2022, 8:28 AM
if remember doesn’t work, the problem is probably not the viewModel
a
allan.conda
06/08/2022, 2:39 PM
Only this VM specifically right? It might be the Scaffold as recomposition can be sometimes weird within that component😄
m
myanmarking
06/09/2022, 8:48 AM
idk. it is very weird. remember should work no matter how bad you screw up. Maybe you have two viewmodel instances somehow ? no idea