Sanity Library Reference Docs
    Preparing search index...

    Interface CommentsOptionsBeta

    Which of a document's comments to read.

    interface CommentsOptions {
        dataset?: string;
        documentId: string;
        documentType: string;
        fieldPath?: string | Path;
        liveEdit?: boolean;
        perspective?: ReleasePerspective | ClientPerspective$1;
        projectId?: string;
        resource?: DocumentResource;
        scope?: CommentsReadScope;
        status?: CommentStatus;
    }

    Hierarchy (View Summary)

    Index

    Properties

    dataset?: string
    documentId: string
    documentType: string
    fieldPath?: string | Path

    Narrow to one field. Omit to get every comment on the document.

    liveEdit?: boolean

    Indicates whether this document uses liveEdit mode. When true, the document does not use the draft/published model and edits are applied directly to the document.

    perspective?: ReleasePerspective | ClientPerspective$1
    projectId?: string
    resource?: DocumentResource

    Explicit resource to use. On an individual operation this overrides any default; on a SanityConfig it becomes the instance's default resource. Unlike projectId/dataset, this can also be a media library or canvas resource.

    Which of the document's comments to read.

    • 'perspective' follows what you are viewing: a release shows that release's comments, anything else pools draft and published.
    • 'exact' matches only the precise document id passed.
    • 'all' returns every comment on the document.

    'perspective' recognises a release from the {releaseName} form. A stacked ClientPerspective array names several layers at once, with no single release to read comments from, so it pools draft and published as any other non-release perspective does. To read the pooled list while a release is in view, pass a non-release perspective alongside; to name a release yourself, pass a version id as the documentId.

    A content variant is stored as a version document, so under 'perspective' its comments form a list of their own, the way a release's do. A variant's draft and published comments are separate lists: pairing them needs the variant's name, which its document id does not carry.

    'perspective'
    
    status?: CommentStatus

    Narrow to open or resolved threads. Omit for both.