👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

I’d love some help understanding how to work with drafts and published documents. I’m running into issues with including drafts in queries because documents that are published...

1 replies
Last updated: Jan 5, 2021
I’d love some help understanding how to work with drafts and published documents. I’m running into issues with including drafts in queries because documents that are published but also have unpublished changes return two separate items,
<_id
and
drafts.<_id>
. How can I achieve something similar to the studio’s documents list pane, where each item shows only one time whether or not it’s published and there’s an edit icon if there are changes?
Jan 5, 2021, 12:02 AM
Finally found it! For anyone else looking for this in the future, you can find the
collate
util implemented here in the source code: https://github.com/sanity-io/sanity/blob/f4b66a8695b30d387a2de97d3737252616854a54/[…]nity/desk-tool/src/panes/documentsListPane/DocumentsListPane.js
Jan 5, 2021, 2:30 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?