Skip to content

[Feature Request] Add support for perspectives in plugin options #274

@fvieira

Description

@fvieira

Is your feature request related to a problem? Please describe.
Yes. If I use overlayDrafts, my documents are a mix of drafts and published versions, and the ids reflect this, which makes it impossible to write simple queries like sanityDocument(_id: {eq: "my-document-singleton"}) as this will only fetch the document correctly if it doesn't have a draft version, as otherwise the document id would be drafts.my-document-singleton.
As such I have to write the query like this sanityDocument(_id: {regex: "/^(drafts.)?my-document-singleton$/" }) which is way uglier.

Describe the solution you'd like
I'd like to be able to pass the perspective as an option to the plugin, so that it ends up in the sanity client.
This would allow me to use the previewDrafts perspective instead of overlayDrafts, which results in almost the same result but now no document has drafts. which allows me to write simpler queries.
There may be other advantages to supporting perspectives, specially as their functionality grows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions