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.
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 likesanityDocument(_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 bedrafts.my-document-singleton
. As such I have to write the query like thissanityDocument(_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 ofoverlayDrafts
, which results in almost the same result but now no document hasdrafts.
which allows me to write simpler queries. There may be other advantages to supporting perspectives, specially as their functionality grows.