Guilherme Delgado
02/11/2022, 12:03 PMinit {}
it’s called twice.
I’m using jetpack compose (1.1.0 and it happened also with 1.1.0-rc01):
• ActivityA has ViewModelA and everything is ok.
• ActivityB has a AnimatedNavHost
with 3 composable (“screens”). When they’re first created I get this 2 time problem, but after that, when I change between them, the init {}
is called only once as expected.
What could it be?Marcello Galhardo
02/11/2022, 2:31 PMinit
method called twice.Guilherme Delgado
02/11/2022, 2:49 PMcomposable(route = NavRouting.Home.destination) {
HomeScreen(hiltViewModel())
}
Marcello Galhardo
02/11/2022, 2:55 PMinit
method and reproduce the “call init twice” and ensure the this
instance is exactly the same? (If you don’t know how to do it, see my picture below: the value after @
should tell you if the instances are the same or not).Guilherme Delgado
02/11/2022, 3:09 PMinit { logger.i("blah") {"$this"}}
Ravi
02/11/2022, 5:01 PMAnimatedNavHost
is recomposing twiceGuilherme Delgado
02/11/2022, 6:19 PMLaunchedEffect
doing thing it shouldn’t