I'm following this guide: <https://developer.andro...
# compose-android
h
I'm following this guide: https://developer.android.com/develop/ui/compose/layouts/adaptive/list-detail to implement an adaptive layout with a list and details pane. When I wrap my panes with
AnimatedPane
, the
LaunchedEffect(Unit)
inside my list pane gets triggered again when navigating back from the details pane. However, if I include the panes without using
AnimatedPane
, the effect only triggers once on the initial launch. Is this expected behavior when using
AnimatedPane
?
m
Put the launchedeffect outside the animatedpane. Pd: avoid crossposting pls
h
Is this behavior intended to mimic how navigation works in a non-adaptive layout—where navigating from the list screen to the details screen and back would naturally recreate the list screen and retrigger effects like
LaunchedEffect(Unit)
?
m
If you're using a library called m3-adaptive i suposse that you have to be careful with recomposition (i assume you work with compose), the launched effect Is derived from a ui state?
h
I’m using
LaunchedEffect(Unit)
to trigger certain events only once when the screen appears—like logging the screen name. I just want to confirm my understanding: when using
AnimatedPane
, this behaves similarly to navigating between separate list and detail destinations, causing the list pane to be re-entered and the effect to retrigger. Without
AnimatedPane
, the effect only triggers once, likely because the scaffold adds the panes to the composition just once and doesn’t recreate them when navigating between them.