Skip to content

Interface: HotSwapOwner ​

Defined in: src/wirestate-core/hot/hot-owner.ts:16

A framework provider that owns a managed container and can rebuild it during a hot swap.

Remarks ​

Registered by framework integrations (for example the React ContainerProvider) for every managed container while it is committed. The swap orchestrator reads the current container, tears it down, constructs a replacement through HotSwapOwner.create, and hands it back through HotSwapOwner.commit.

Methods ​

commit() ​

ts
commit(container: Container): void;

Defined in: src/wirestate-core/hot/hot-owner.ts:53

Commits the replacement container to the owner's view layer.

Parameters ​

ParameterTypeDescription
containerContainerReplacement container to publish.

Returns ​

void


create() ​

ts
create(config: ContainerConfig): Container;

Defined in: src/wirestate-core/hot/hot-owner.ts:46

Constructs a replacement container from a remapped config.

Parameters ​

ParameterTypeDescription
configContainerConfigRemapped config with up-to-date classes and parent.

Returns ​

Container

Replacement container.

Properties ​

config ​

ts
config: ContainerConfig;

Defined in: src/wirestate-core/hot/hot-owner.ts:38

Config the current container was constructed from.

Remarks ​

Class references inside may be stale after module replacement. The orchestrator remaps them to their newest generations before calling HotSwapOwner.create, then writes the remapped config back here so the owner describes the container it now holds.

Register one long-lived owner object rather than a fresh one per render: an owner recreated from the original config would read as outdated on every later swap and rebuild its container needlessly.


container ​

ts
container: Container;

Defined in: src/wirestate-core/hot/hot-owner.ts:24

Container currently committed by the owner.

Remarks ​

Mutated by the orchestrator after a swap so parent-chain lookups in a later swap see the live container.