✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Previewing Drafts in the Studio - Is it Possible?

1 replies
Last updated: May 19, 2020
Next preview-related question: I'm trying to add support for previewing drafts. I've added ``?rev=${document._rev}`` to the preview URL. We fetch content server side, so this means our app will add
_rev == "..."
to the query when the
rev
query parameter is available (and also send an access token). This works, but not as consistently as I'd hoped.
1. It seems that publishing new revisions makes old revisions go away?
2. The revision given to me in the preview plugin doesn't always seem to be the most recent? If I edit a document, and click the URL, the provided revision sometimes doesn't return any data. If I navigate to another document in the studio, and back to my draft, I'm seeing a different rev, and with this one I find data.
May 18, 2020, 7:44 AM
I was mistakenly using the query API. The history API does what I want 👌
May 19, 2020, 4:32 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?