Sanity Library Reference Docs
    Preparing search index...

    Type Alias CreateCommentOptionsBeta

    CreateCommentOptions: DocumentHandle & {
        anchor?: CommentAnchor;
        commentId?: string;
        context?: Record<string, unknown>;
        documentRevisionId?: string;
        fieldPath?: string | Path;
        message: CommentMessage;
        threadId?: string;
    }

    Type declaration

    • Optionalanchor?: CommentAnchor

      Anchors the comment to a run of text inside the field, by offset into the Portable Text blocks it spans. Leave it out for a field-level comment.

      The API resolves it into the stored selection and content snapshot, so what comes back is Comment.selection rather than the anchor itself.

    • OptionalcommentId?: string

      Reuse the id of a failed comment to retry it. Defaults to a new id.

    • Optionalcontext?: Record<string, unknown>

      Ambient information stored alongside the comment, for the writing app's own use. Deliberately loose: the comment API treats this as free-form, so no shape is worth promising.

    • OptionaldocumentRevisionId?: string

      The _rev of the document when the comment was written.

      Not filled in automatically: the SDK's local document revision is replaced by a transaction id while an edit is in flight, so it can name a revision that never reached the server.

    • OptionalfieldPath?: string | Path

      Which field the thread hangs off, for example title or body[_key=="intro"].content.

      Leave it out, or pass '' or [], to comment on the document as a whole. Such a comment is written without a path and reads back with fieldPath: ''. The Studio's field comments leave these out, so they don't show in its comments inspector.

    • message: CommentMessage
    • OptionalthreadId?: string

      Defaults to a new id, which starts a new thread.