Learn / Wiring
Why use an assembly instead of hand-wiring?
With hand-wiring, forgetting a branch or omitting Data.subscriptions(active) compiles cleanly and fails silently at runtime. An assembly catches those omissions before shipping:
completechecks derivations: Passing a non-derivedupdate,subscriptions,url,init, ormanagedResourcesfails to compile whenever an item in the list requires it.- Startup checks catch collisions: Two wirings claiming the same non-shared Message tag, sharing a
key, or registering the same resource tag failPage.assemblewith both names in the error. - Exhaustive
owncatches a deleted wiring: When a wiring claims literal tags (such as Remote's Message tags), removing it fromassemble(...)puts those tags back intoown's input type, causing an exhaustiveMatch.valueTagsor unionmatchto fail compilation.
Note that deleting a wiring whose tags are all shared (such as a mirror), or using a non-exhaustive switch in own, leaves own's types satisfied. Test those behaviors with dispatch-level tests.
When to wire by hand instead
- A single integration: If your app has one integration already covered by a dispatch test, hand-wiring is straightforward and remains fully supported.
- Custom routers:
wiring.urlassumes a single URL Message; apps with a multi-route router keep their router and feed URL changes to mirrors directly. - Standalone scopes: Without a parent
ModelandMessageunion, there is nothing forPage.assembleto join.