Are there any examples to understand “recompositio...
# compose
Are there any examples to understand “recomposition is optimistic” ?
I don’t have any examples, but as I understand it, this is basically a way of saying that one should not depend on side effects running in composition for correctness, as recompositions may be discarded at any point. So plan accordingly and don’t rely on such side-effects.
👍 1
thank you~ . I want to write a sample to simulate a case that recomposition is discarded , but I can’t 😂
You could do a
throw Exception
from inside a composable, that should make a composition fail maybe?
Doing a quick search inside this channel brought up this message, so I guess yes, this should make a recomposition fail.
thank you ,very helpful~
I believe you can also use
to “precompose” something and then discard that composition before actually using it in layout. Lazy lists might do this if you change scroll direction in the middle of a scroll.