How is Compose detecting that a new render needs t...
# compose-android
l
How is Compose detecting that a new render needs to be done? For example, when a state changes, but doesn't lead to changes in the tree. Which APIs let Compose UI for Android know that it needs to ask the system to redraw (calling invalidate)?
s
Usually state updates, most modifiers use
observerReads
to track layout/draw changes
l
What is
observerReads
? Where does it come from?
Digging deep, I found about the
SnapshotStateObserver
class, which has an
observeReads
function that executes a block and calls a callback when one of the states read inside said block was changed.
z
draw is invalidated based on: 1. state reads inside draw* modifiers 2. changes in composition/layout phases 3. Modifier.Node invalidate calls Maybe I forgot something, but i think those are the main paths