var isInitialized by remember { mutableStateOf(false) }
Log.d("aos","CompleteRoute")
LaunchedEffect(Unit) {
if(isInitialized) return@LaunchedEffect
isInitialized = true
Log.d("aos","LaunchedEffect")
}
d
Dominaezzz
06/09/2023, 8:00 AM
Because the surrounding composable is called multiple times?
b
Bwaim
06/09/2023, 8:29 AM
It should not be launched once when entering in the composition ? (I mean not at each recomposition)
d
Dominaezzz
06/09/2023, 8:47 AM
It is launched once per call
s
Stylianos Gakis
06/09/2023, 9:15 AM
It should not be launched once when entering in the composition ? (I mean not at each recomposition)
This is still true though. "Once per call" I assume here puts the emphasis that if you call the composable from multiple places then yes it will be called once per each call site.
Other than that it shouldn't run multiple times, how do you call it which makes it trigger multiple times as you say? Is it perhaps part of an if/else statement where it enters and exits composition multiple times?