Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fvieira opened this issue Oct 25, 2023 · 0 comments
Open

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

fvieira opened this issue Oct 25, 2023 · 0 comments

Comments

@fvieira
Copy link

fvieira commented Oct 25, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant