uli
10/12/2023, 4:34 PMfun setupCompose(val value: Int) {
composeView.setContent {
LaunchedEffect(kotlin.Unit) {
println("Uli: Effect Launched")
}
MyValueView(value)
}
}
var myValue = 0
repeat(10) { setupCompose(myValue++) }
I was suspecting the effect to fire 10 times, as the composable is being setup from scratch. Well, it didn’t. It fired only once.
Now I am wondering, if anything, could break the optimization and actually lead to the effect firing 10 times, or if I can rest assured that resetting the composeView’s content does not enter a new compositionPablichjenkov
10/12/2023, 4:53 PMuli
10/12/2023, 4:54 PMPablichjenkov
10/12/2023, 4:56 PMSideEffect
which executes per recomposition but LaunchEffect runs only once when the Composable enters the composition treeuli
10/12/2023, 4:56 PMPablichjenkov
10/12/2023, 4:57 PMuli
10/12/2023, 4:58 PMPablichjenkov
10/12/2023, 5:03 PMset
part in the name is probably misleading i guessuli
10/12/2023, 5:12 PMAlbert Chang
10/13/2023, 12:48 AMuli
10/13/2023, 4:54 AMZach Klippenstein (he/him) [MOD]
10/13/2023, 12:59 PM