vapor-chamber API reference - v1.3.0
    Preparing search index...

    Type Alias OptimisticUndoOptions

    type OptimisticUndoOptions = {
        predict?: (cmd: Command) => any;
        onRollback?: (cmd: Command, error: Error) => void;
        onRollbackError?: (
            cmd: Command,
            undoError: Error,
            originalError: Error,
        ) => void;
    }
    Index

    Properties

    predict?: (cmd: Command) => any

    Predict the optimistic result returned immediately to the caller. If omitted, returns { ok: true, value: undefined } as the optimistic result.

    onRollback?: (cmd: Command, error: Error) => void

    Called when the real handler fails and the undo handler runs. Use this to notify the UI of the rollback (e.g. show a toast).

    onRollbackError?: (cmd: Command, undoError: Error, originalError: Error) => void

    Called when the undo handler itself throws during rollback. If omitted, errors are logged to console.error.