Which version of Compose do you use? This looks li...
# compose
s
Which version of Compose do you use? This looks like nested subcomposition dispose, but it is supposed to look slightly differently on newer versions
j
Yes, an old one. Is it supposed to get better in newer ones? 🙂
composeBom = "2023.10.01"
s
This one is not that old, tbh In general, onForgotten blocks are disposing launched effects / disposable effects, but I don't remember seeing nested disposal before outside of subcompose layout.
I would check what this block does in debugger, maybe you get some idea of where it is coming from
j
In other words, having fewer LaunchedEffects will reduce the time spent on their cleanup, right?
s
That is correct, as a general rule, coroutines are not free, so fewer launches/cancels is always good launched effects are never nested really though, so it is unlikely what you see here
j
Thank you 🙂
s
Or perhaps you've mistakenly used a frequently changing state as the key for a
LaunchedEffect
, like this:
LaunchedEffect(key = animatedState.value) { ... }
.
🤔 1
👍 1
s
Rather than looking at launched effects, consider checking your subcompose layout usage (e.g. nested lazy or box with constraints). It looks more like that rather than something else.
👍 1