Sanity Library Reference Docs
    Preparing search index...

    Variable useAgentPatchConst Alpha

    useAgentPatch: () => (options: AgentPatchOptions) => Promise<AgentPatchResult> = ...

    Schema-aware patching with Sanity Agent Actions.

    • Validates provided paths/values against the document schema and merges object values safely.
    • Prevents duplicate keys and supports array appends (including after a specific keyed item).
    • Accepts documentId or targetDocument (mutually exclusive).
    • Optional async, noWrite, conditionalPaths.

    Returns a stable callback that triggers the action and resolves a Promise with the patch result.

    Type declaration