Is the following correct? 1. `@Composable` functi...
# compose
m
Is the following correct? 1.
@Composable
functions schedule changes to the slot table via a
Composer
2. The
Composer
records the scheduled changes in a list and hands it over to an
Applier
3. The
Applier
executes the scheduled changes and alters the slot table and the actual node tree Edit: If the
Composer
knows that we’re already in the middle of
inserting
new nodes, it directly alters the slot table? What does the
Applier
do in that case? Wait for that to be done so it can start altering the actual node tree?
s
Applier is only responsible for nodes Slot table changes and effects are executed through Composer during the apply changes phase. Composer never changes the slot table directly, it records changes to a different insert table instead which is later merged to the main slot table.
m
@shikasd I really appreciate the explanation, but I’m an absolute beginner and I still find the compose internals overwhelmingly complex and incomprehensible. I have a follow-up question if you don’t mind me asking: 1.
@Compoable
functions emit slot table changes to schedule to a given
Composer
2. the
Composer
does something (what?) 3. An
Applier
(who decides which one to use and owns it?) applies the scheduled changes (how does it know which ones have been scheduled?) to the node tree Is this what happens and could you please help me understand the missing pieces?
s
Composer puts all changes in the
ChangeList
, which is later executed. ChangeList operations get a reference to the slot table writer and applier, so they can perform arbitrary operations on them. This is finalized by executing all remember observers in order to run things like
DisposableEffect
.