This message was deleted.
# compose
s
This message was deleted.
j
Because otherwise you'll add nodes twice to their parents
It's the same tree traversal, you're just choosing in which direction to build the tree
In Redwood we actually use both callbacks and we add some nodes while going down and others while going up https://github.com/cashapp/redwood/blob/trunk/redwood-compose%2Fsrc%2FcommonMain%2Fkotlin%2Fapp%2Fcash%2Fredwood%2Fcompose%2FWidgetApplier.kt#L88-L112
The caller is composable functions
The tree corresponds to the implicit call graph (which is always a tree)
Because then each node would get added twice
You can either add the nodes to the tree when walking down each branch or when coming back up
Yes, the comments indicate why. We add some nodes when walking down and others when walking up
The same nodes are visited in both directions. So if you have
A { B { C() } }
, the calls would be root/down/A, A/down/B, B/down/C, B/up/C, A/up/B, root/up/A
(I can't format it the same way you did on mobile)
I'm not sure what you mean by "without visiting". The Composer has recorded all of the changes to the SlotTable (which maintains the nodes). Once the recomposition was successful those changes are applied to the tree using the
Applier
by moving its current node to the parent, and then invoking any of the manipulation callbacks (insert, move, remove).