Skip to content

Function: hotCellGraph()

hotCellGraph<G>(key, build, hot?): Accessor<G>

Defined in: hot-graph.ts:107

Build a cell graph that survives hot edits.

Disposes the previous graph (if this module is re-evaluating), builds a new one over the durable roots via cellGraph, publishes it through a durable box, and self-accepts the HMR update when handed a hot context.

Returns a stable accessor that components read on every access — graph().rose, never a module-level cell export — so no component can hold a reference to a disposed graph across a swap. The accessor is reactive: a hot swap re-renders every consumer.

The return type is Accessor<G>, not Accessor<G | undefined>: the graph is built synchronously before this function returns, and reads never route through a signal's value (see GraphBox). Consumers need no <Show when={graph()}> guard for a state that cannot occur.

Type Parameters

G

G

Parameters

key

string

Namespace for the durable box. One per page in a multi-notebook app ("morphogen", "seismos"); they share one registry.

build

() => G

Runs inside createRoot — create cells and effects here.

hot?

HotContext

The calling module's import.meta.hot. See the note above.

Returns

Accessor<G>