Are `LaunchedEffect`(s) and `DisposableEffect`(s) ...
# compose
p
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
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
This actually explains some of the behaviour I observed when playing around with navigation + effects. I totally didn't think about animations!
a