Bundle / foldkit-bundle
The placed parts
Each placement exposes its parts in parent terms:
| Part | Type | Built from |
|---|---|---|
placed.update(parent, message) | Option<Update.Return>: None when the Message is not this placement's | Update.foldChildStep |
placed.init | Update.Step: writes the child's initial Model and lifts its Commands | Update.foldChildInit |
placed.subscriptions | a Subscriptions record keyed Name@path/key | Subscription.lift with a gate |
placed.resources | a Managed Resources record keyed Name@path/key | ManagedResource.lift |
placed.view(parent, h, viewInputs?) | Html; nothing while the child is absent | h.submodel |
placed.viewIn(slot) | the same view under another slot id, to render one placement in two positions | h.submodel |
placed.helpers.name(...input) | Update.Step for a programmatic entry point | Update.foldChildStep |
Keys are prefixed with the placement, so two placements of one bundle never
collide in Subscription.aggregate.
A placed view is drawn again only when its child's Model changes. A view
drawn without inputs is given its Model alone, so while the parent holds the
same child object the last drawing is handed back, and Foldkit neither runs
the view nor diffs its tree: a Message for one placement leaves every other
placement's drawing as it was. The child's Model changes identity exactly when
its update changed it (a no-op returns the Model it was given). A view
drawn with viewInputs, which a parent usually builds per render, is drawn
every time, and so is every view while a server renders. A view that reads
something outside its Model (a clock, a module's mutable state) opts out with
memo: false in the placement config. A collection's items are kept the same
way, each by its own Model.