SheetXL - v1.0.2
    Preparing search index...

    Callbacks a transaction is begun with, called by the store as the transaction and the operation it belongs to settle.

    A nested transaction is a savepoint: committing it merges its writes into its parent, where they can still be rolled back with an outer transaction. So the outcome hooks report the OPERATION's outcome - onCommit once the root lands, onRollback when this transaction or any one it is nested in rolls back - and only one of them is ever called.

    interface Hooks {
        writes?: readonly string[];
        flush?(): void;
        onChildCommit?(
            child: ITransaction,
            intents: Readonly<Record<string, any>>,
        ): void;
        onCommit?(commit: ICommit): void;
        onRollback?(): void;
    }

    Hierarchy (View Summary)

    Index
    writes?: readonly string[]

    The records flush writes: a read of one from the store (IStore.getState) flushes first, so a reader never sees them without the held writes.

    Only the records the held writes change - a reader of anything else, including the writer itself deciding what to hold, reads as it would. A read made through a transaction (ITransaction.getState) sees that transaction and does not flush.

    • Make the writes the caller holds for this transaction, into it.

      Returns void

      The caller holds writes to make them together; the store calls this whenever something needs them made: before another transaction begins inside this one, before this one commits, and before a read of a record the writes change (writes). A flush writes by beginning transactions inside this one; those do not flush it again.

    • Called each time a transaction begun directly inside this one commits, while this one is still open.

      Parameters

      • child: ITransaction

        The transaction that committed. It has closed: what this hook writes begins inside this transaction, and is itself reported here when it commits.

      • intents: Readonly<Record<string, any>>

        What child, and everything nested in it, recorded with ITransaction.setIntent, on its own. The operation's intents (ITransaction.getIntent) hold the union.

      Returns void

      For a caller that reacts to each step of an operation as it happens, rather than once when it lands (onCommit). Deeper transactions are part of the step that holds them and are not reported on their own. A child that rolls back is not reported.

    • Called once the operation this transaction belongs to has landed.

      Parameters

      • commit: ICommit

        The root's commit. An operation that wrote nothing is elided but still counts as landed.

      Returns void

    • Called when this transaction, or any transaction it is nested in, rolls back.

      Returns void