Vision Plugin not returning draft for specific document type

14 replies
Last updated: Jan 28, 2026
Hi! Can someone help me debug a strange inconsistency I'm encountering?Using the Vision Plugin, I cannot get the draft for one type of document, but I can for other types.
This query *[_type == "page" && slug.current == "about"][0].title doesn't get me the draft title, only the published title.
But this query *[_type == "event" && slug.current == "meet-up"][0].title does gives me the draft title, as expected
So puzzling
šŸ¤”
AI Update

This is likely a perspective issue with the Vision plugin! The Vision plugin uses a specific perspective when querying, and this can affect whether you see draft or published content.

The key issue is that the Vision plugin's default perspective behavior has changed. As of the API version 2025-02-19, the default perspective changed from raw to published. This means queries will only return published documents unless you explicitly specify a different perspective.

However, the inconsistency you're seeing between document types suggests something else might be at play. Here are the most likely causes:

1. Check the Vision plugin's perspective setting

In the Vision plugin interface, there should be a perspective dropdown (usually in the top right). Make sure it's set to either:

  • previewDrafts - Shows drafts when they exist, falls back to published
  • raw - Shows all documents including both drafts and published versions

2. Your "page" document might not have a draft

This is the most common cause of this exact behavior. If you're seeing the published title for your "page" document but the draft title for your "event" document, it's possible that:

  • The "event" document has actual unpublished changes (a drafts. version exists)
  • The "page" document's draft was already published, so only the published version exists

You can verify this by checking if a draft exists:

*[_id == "drafts.page-about"]

If this returns nothing, there's no draft version to retrieve.

3. Explicitly query for drafts

If you want to ensure you're getting the draft when it exists, you can use the draft-or-published pattern:

*[_type == "page" && slug.current == "about"]
  | score(_id in path("drafts.**"))
  | order(_score desc)[0].title

This prioritizes drafts but falls back to published versions when no draft exists.

The most likely explanation is that your "page" document simply doesn't have unpublished changes at the moment, while your "event" document does. Try making an edit to the "page" document without publishing it, then run your query again in Vision - you should see the draft title appear.

You can read more about how perspectives work and how Sanity handles draft documents in the documentation.

Show original thread
14 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?