protocol BodyRecomputable
Swift
protocol BodyRecomputable : AnyObject
A retained node that can re-evaluate its own body in place, using
whatever view value it already holds — no new value from a parent is
needed, because nothing about that value changed; only some
@State/@Observable property it reads did, and that storage is a
reference type living outside the struct, so it is already current.
CompositeNode is the only conformer; the protocol exists so
ViewInvalidation can hold a dirty node without depending on its
generic view type.
Sources/LavaUI/State.swift:243
Properties
var invalidationScope: WindowScope? { get }
Which window this node's tree belongs to, captured when it mounted.
Needed because the node, not the caller, decides where a targeted
.body invalidation goes: an @Observable model mutated from window
A's click handler can be observed by a node in window B, and B is the
one that has to recompute. The ambient scope at the moment of the
write is therefore the wrong answer; the one at the moment of the
mount is the right one. nil falls back to ambient.
Sources/LavaUI/State.swift:255
var invalidationScope: WindowScope? { get }
No scope of its own: fall back to the ambient window.
Sources/LavaUI/State.swift:260
Methods
func recomputeBody()
Re-runs this node's body against the view value it already holds.
Sources/LavaUI/State.swift:245