Hey everyone is `LaunchedEffect`'s block executed ...
# compose
s
Hey everyone is `LaunchedEffect`'s block executed together with composition phase, or after the composition phase is completed? I saw in the official docs,
SideEffect
is executed after the composition is completed, can't find the same info for
LaunchedEffed
.
Copy code
LaunchedEffect(messages, lazyListState) {
   // In this block can I assume that "messages" and "lazyListState" are synced? Has "lazyListState" already had the info of current "messages"' items, such as itemCount,...
}
s
LaunchedEffect in any case launches a coroutine, which won’t run in the same frame as the first composition. Even what you do in there is not anything that is suspending itself
If either of those two keys change the old effect will just be cancelled and a new one will be scheduled to run, is that what you are worried about here?
👍 1
s
This is basically what I am worried
Copy code
LaunchedEffect(messages, lazyListState) {
   // In this block can I assume that "messages" and "lazyListState" are synced? Has "lazyListState" already had the info of current "messages"' items, such as itemCount,...
}
s
I'm still not sure what you're worried about, I replied about this right above. You can run the app and log what you get in there to see what exactly you'll be seeing.
s
Thank you!