Interface CauslContextValue<Msg>

Shape of the value travelling through CauslContext.

update is optional: a provider may supply a graph for read-only subscription consumers without also installing a dispatch surface. Hooks that need dispatch (see useDispatch) throw a descriptive error when update is absent.

interface CauslContextValue<Msg = unknown> {
    families: Map<string, FamilyEntry>;
    familyNamespace: string;
    graph: Graph;
    update?: Update<Msg, Graph>;
}

Type Parameters

  • Msg = unknown

    The application's message union, when an update runner has been wired up. Defaults to unknown so the context can be created without committing to a specific Msg type at the module-creation site.

Properties

families: Map<string, FamilyEntry>

Per-provider registry consumed by useCauslFamily. Each <CauslProvider> mount owns a fresh map so two providers around the same graph keep their own family namespaces; nodes are not shared by accident.

The map is mutable in place — refcount increments and decrements happen during effect cleanup, so the reference itself is stable across renders.

familyNamespace: string

Provider-instance prefix applied to every engine node id a family factory registers (#132). The engine has a single id namespace, so two <CauslProvider> mounts over the same graph would collide with DuplicateNodeError the moment they register the same factory-derived id. Prefixing each provider's family ids with a unique string keeps the isolation the family registry promises at the React level honest all the way down at the engine level: the same key resolves to two distinct engine nodes, one per provider.

Generated once per provider mount alongside families and stable across renders (both are keyed on the graph handle). Reset when the host swaps the graph, so the new graph gets a fresh namespace with no leak from the old one.

graph: Graph
update?: Update<Msg, Graph>