This message was deleted.
# compose
s
This message was deleted.
z
You're on the right track. When a click handler changes state, it triggers the global write observers. Compose’s runtime registers one of those which advances the global snapshot, triggering a snapshot apply observer (also triggered when a change is made inside an explicit snapshot). That is the signal that “something changed”. Compose’s apply observer notes what changed and then requests a new frame (if it hasn't already) and schedules the real work to happen when that frame starts to get produced (see
runRecomposeAndApplyChanges
). It recomposes all the recompose scopes that were invalidated. A scope can be invalidated either because it read some state that was changed (and that change was observed by the apply observer), or explicitly via a
RecomposeScope
object. Recomposing one scope can invalidate more, so it just keeps looping until there are no more invalidated scopes left. Then it commits all those changes, updates modifiers, and starts effects before giving control back to the frame scheduler (Choreographer on Android) to do other phases like layout and drawing.