```@Composable fun Testing() { val myValue by ...
# compose
c
Copy code
@Composable
fun Testing() {
    val myValue by asdf.collectAsState(initial = "nunya")
    LaunchedEffect(token) { Log.e("ABC", "LE with $myValue") }
    ...
}

val asdf = flow { repeat(10){
    emit("a")
    delay(2000)
    }
}
Why does the above output
Copy code
13:53:45.647  E  LE with a
13:53:45.756  E  LE with a
I was expecting
LE with nunya
and then
LE with a
, but why is it LE with a, twice?
Maybe there's a way to actually print out what the value was of the LE's key at the time the LE was launched
s
Since LaunchedEffect also launches a coroutine I suppose the order in which these things happen result in this. If you had a log inside a DisposableEffect instead I would expect to see "nunya" instead.
👍 1
m
LaunchedEffect block is scheduled to run on the next frame. this is one of the main differences between LaunchedEffect and DisposableEffect. so, the log statement will never get a chance to be executed before
asdf
initializtion which happens on the current frame.