https://kotlinlang.org logo
#compose
Title
# compose
p

Philipp Kleber

04/28/2022, 1:08 PM
Are `LaunchedEffect`(s) and `DisposableEffect`(s) guaranteed to be executed in order of composition? To illustrate this, let's say I quickly switch between two routes using a
NavController
and both of these routes have a
DisposableEffect
. Is the last effect of the route I stop at guaranteed to have been executed after the effect of the other route (the one which I did not stop at)?
a

Adam Powell

04/28/2022, 1:33 PM
The answer to your first question might not be helpful for your follow-up because transition animations cause the composition lifetime of destinations to overlap during the animation, and the ordering of different navigation destinations in a composition aren't necessarily defined when they're shown concurrently
p

Philipp Kleber

04/28/2022, 1:38 PM
This actually explains some of the behaviour I observed when playing around with navigation + effects. I totally didn't think about animations!
a

Adam Powell

04/28/2022, 1:48 PM
16 Views