Sanity Library Reference Docs
    Preparing search index...

    Interface ListenOptions

    interface ListenOptions {
        effectFormat?: "mendoza";
        events?: ListenEventName[];
        includeAllVersions?: boolean;
        includeMutations?: boolean;
        includePreviousRevision?: boolean;
        includeResult?: boolean;
        tag?: string;
        visibility?: "query" | "transaction";
    }
    Index

    Properties

    effectFormat?: "mendoza"

    Format of "effects", eg the resulting changes of a mutation. Currently only mendoza is supported, and (if set) will include apply and revert arrays in the mutation events under the effects property.

    See The mendoza docs for more info

    undefined

    events?: ListenEventName[]

    Array of event names to include in the observable. By default, only mutation events are included.

    ['mutation']

    includeAllVersions?: boolean
    includeMutations?: boolean

    Whether or not to include the mutations that was performed. If you do not need the mutations, set this to false to reduce bandwidth usage.

    true

    includePreviousRevision?: boolean

    Whether or not to include the document as it looked before the mutation event. The previous revision will be available on the .previous property of the events, and may be null in the case of a new document.

    false

    includeResult?: boolean

    Whether or not to include the resulting document in addition to the mutations performed. If you do not need the actual document, set this to false to reduce bandwidth usage. The result will be available on the .result property of the events.

    true

    tag?: string

    Optional request tag for the listener. Use to identify the request in logs.

    undefined

    visibility?: "query" | "transaction"

    Whether events should be sent as soon as a transaction has been committed (transaction, default), or only after they are available for queries (query). Note that this is on a best-effort basis, and listeners with query may in certain cases (notably with deferred transactions) receive events that are not yet visible to queries.

    'transaction'