Hi guys! I’m experiencing a strange behaviour. My ...
# orbit-mvi
g
Hi guys! I’m experiencing a strange behaviour. My container is getting created 2 times and thus the init (
onCreate: ((state: STATE) -> Unit)?
) it’s called 2 times. I’m using jetpack compose: • ActivityA has ViewModelA and everything is ok. • ActivityB has a NavHost with 3 composable (“screens”). When they’re first created I get this 2 time problem, but after that, when I change between them, the container is created only once as expected. For now, this is the best hint I can give you, but I’ll look deeper. Any clue? Thanks for your time.
m
Not a lot of info to go on… Can you try debugging to see if the instance of the containerhost class is different in both cases?
also worth upgrading to compose
1.1.0
which came out two days ago
g
Yes I’m using the latest version of compose and orbit. I’ve added a console output in the ViewModel init method and its called twice, I believe this clears Orbit 😊 I’ll ask this question on #compose
m
phew 🙂
😊 1