chanjungskim
06/09/2023, 6:30 AMLaunchedEffect
called multiple times?
var isInitialized by remember { mutableStateOf(false) }
Log.d("aos","CompleteRoute")
LaunchedEffect(Unit) {
if(isInitialized) return@LaunchedEffect
isInitialized = true
Log.d("aos","LaunchedEffect")
}
Dominaezzz
06/09/2023, 8:00 AMBwaim
06/09/2023, 8:29 AMDominaezzz
06/09/2023, 8:47 AMStylianos Gakis
06/09/2023, 9:15 AMIt 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?