Is there a way to check if the current composition...
# compose
b
Is there a way to check if the current composition has already been invalidated and a recompose is pending?
👀 1
🤔 1
z
What are you trying to do?
1
b
I have a stateflow i'm creating via molecule and i'm trying to skip intermediate emissions if I i know it's already "stale".
z
The simplest thing to do would be get the indirection out of the way and host your molecule composables in a UI composable - then you’ll get that behavior for free. If you can’t do that, for lifecycle reasons or something, then maybe there’s a way to get molecule to defer its recomposition pass until some external signal? Which you could wire up to the UI frame signal (eg via withFrameNanos).
I would also suggest asking in #squarelibraries, more of the maintainers are likely to be active there and might have better ideas.
👍 1
b
This stateflow is being consumed on ios too and would like to solve this for both. We were previously solving this (on a library based off square's workflow) by setting a flag whenever an action was received before render completes and re-render if set. That approach might still work but would like to delegate this to compose since it's already doing the book keeping.
z
If Molecule lets you specify your own frame clock then you can just wrap whatever frame clock your platform uses. That’s what compose UI does.
j
Indeed it does