Surface / Surface and Bundle
Is a Bundle like a ManagedResource?
No, though a Bundle may provide one. The confusion comes from both having a lifetime tied to Model state:
- A Bundle owns application truth: it adds
Modelfields andMessagecases to the parent, and itsupdatedecides the next slice. Replay, DevTools, and persistence see it. - A ManagedResource owns no truth: it provides a handle (socket, EventSource,
client) by tag that
Commands andSubscriptions use. It never appears in theModel, never has anupdate, and never produces aMessageby itself.
Consequences: two placements of one bundle are two independent Model slices;
two users of one resource tag would replace each other, so assemble refuses
the second. A bundle with resources cannot be placed per key, for the same tag
reason. placements.resources(own) merges the parent's own resources with each
placement's, keyed by tag.