```while (shouldKeepRecomposing) { awaitWorkAv...
# compose
m
Copy code
while (shouldKeepRecomposing) {
    awaitWorkAvailable()
    // ...
    if (!recordComposerModifications()) continue
    //   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^👆

    // ...
    parentFrameClock.withFrameNanos { frameTime ->
        // ...
        trace("Recomposer:recompose") {
            recordComposerModifications()
        //  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^👆
I know that
Recomposer.recordComposerModifications
converts snapshot invalidations to composition invalidations. But why do we call it twice per iteration in the
recompositionRunner
body loop??
Copy code
if (hasBroadcastFrameClockAwaiters) {
    trace("Recomposer:animation") {
        // Propagate the frame time to anyone who is awaiting from the
        // recomposer clock.
        broadcastFrameClock.sendFrame(frameTime)

        // Ensure any global changes are observed
        Snapshot.sendApplyNotifications()
    }
}
Ah it’s probably because of this
if
that precedes the
trace
block. Something that has waiting for the next frame might write to the global snapshot after the initial call to
Recomposer.recordComposerModifications
has converted all snapshot invalidations to composition invalidations which would result in more and newer snapshot invalidations to also convert
s
withFrameNanos
is a suspend call, so we might accumulate new changes between those two
🙏 1
m
Thanks!