DynamicVesselHandle
Defined in: packages/react/src/lib/dynamic-vessel-types.ts:28
Handle returned by m.registerVessel() for dynamically registered vessels.
Provides typed hooks scoped to the registered vessel and a cleanup method.
Type Parameters
Section titled “Type Parameters”V extends VesselDefinition
Properties
Section titled “Properties”unregister
Section titled “unregister”unregister: () =>
void
Defined in: packages/react/src/lib/dynamic-vessel-types.ts:66
Remove vessel from all registries (vesselManager, componentMap, loadingMap)
Returns
Section titled “Returns”void
update
Section titled “update”update: (
definition) =>UpdateVesselResult
Defined in: packages/react/src/lib/dynamic-vessel-types.ts:64
Republish this vessel’s definition — its description, variants, and action parameters — without touching its component registration, so the vessel does not remount and keeps any DOM/canvas state it owns.
This is the runtime-registration counterpart to m.updateVessel(): a
vessel registered via registerVessel() never appears in the factory’s
vessels tuple, so m.updateVessel() cannot name its id at the type
level. handle.update() closes that gap — V is exactly the
definition inferred at the registerVessel() call site, fixed at
compile time, so definition is checked against it the same way
m.updateVessel() checks a factory-declared vessel’s payload against
the entry passed to createMaelstrom({ vessels }).
Enforces the same runtime guards as m.updateVessel(): throws a plain
Error if no Provider is mounted, the vessel id is not registered, or
the definition fails validation. Returns { ok: false, conflict }
instead of throwing if a live instance’s current variant is missing
from the new definition ('variant_dropped'), if the new definition
drops an action that instance’s variant still declares
('action_dropped'), or if a command batch is already queued or in
flight ('batch_in_flight') — see m.updateVessel()’s JSDoc for the
full result contract.
Parameters
Section titled “Parameters”definition
Section titled “definition”Returns
Section titled “Returns”Example
Section titled “Example”const handle = m.registerVessel(widgetEntry);const result = handle.update({ ...widgetEntry.vessel, description: 'Updated widget' });if (!result.ok) { console.warn(result.conflict.message);}useActions
Section titled “useActions”useActions: (
instanceId,runner) =>void
Defined in: packages/react/src/lib/dynamic-vessel-types.ts:32
Typed action runner registration — equivalent to m.useActions(vesselId, instanceId, runner) but pre-scoped
Parameters
Section titled “Parameters”instanceId
Section titled “instanceId”string
runner
Section titled “runner”ActionRunner<V>
Returns
Section titled “Returns”void
useVessel
Section titled “useVessel”useVessel: (
instanceId) =>TypedVesselProps<V> |null
Defined in: packages/react/src/lib/dynamic-vessel-types.ts:30
Typed vessel props hook — equivalent to m.useVessel(vesselId, instanceId) but pre-scoped
Parameters
Section titled “Parameters”instanceId
Section titled “instanceId”string
Returns
Section titled “Returns”TypedVesselProps<V> | null