stax-monorepo
    Preparing search index...

    Interface ReconcileConfig<A, E, R>

    Configuration for the reconcile function.

    interface ReconcileConfig<A, E = never, R = never> {
        container?: () => Element<unknown, E, R>;
        getItemForKey?: (key: string, value: A, prepared: unknown) => unknown;
        getTargetKeys: (value: A) => readonly string[];
        ordered?: boolean;
        prepare?: (value: A) => unknown;
        renderSlot: (
            key: string,
            value: A,
            ctx: { index: Signal.Signal<number>; item: Signal.Signal<unknown> },
        ) => Element<unknown, E, R>;
    }

    Type Parameters

    • A

      The type of the reactive value

    • E = never

      Error type

    • R = never

      Requirements type

    Index
    container?: () => Element<unknown, E, R>

    Optional custom container factory

    getItemForKey?: (key: string, value: A, prepared: unknown) => unknown

    Get the item value for a given key (used by each). Receives the result of the optional prepare hook — for each, that's a Map<string, A> built once per sync, turning per-slot lookup from O(n) into O(1).

    getTargetKeys: (value: A) => readonly string[]

    Derive target slot keys from the current value

    ordered?: boolean

    Whether slot order matters (true for each)

    prepare?: (value: A) => unknown

    Optional per-sync precomputation. Called exactly once at the start of each sync; the result is threaded into every getItemForKey call for that sync and then discarded.

    Exists so each can build a key→item index once per update instead of scanning the list per slot. Deliberately NOT cached across syncs: SignalArray mutates its backing array in place and re-emits the same reference, so any identity-keyed memo would go stale and mis-render.

    renderSlot: (
        key: string,
        value: A,
        ctx: { index: Signal.Signal<number>; item: Signal.Signal<unknown> },
    ) => Element<unknown, E, R>

    Render a slot given its key and the current value