Debugging inconsistency with Vision Plugin and draft titles in Sanity.io
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 publishedraw- 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].titleThis 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.
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.