How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Vision Plugin not returning draft for specific document type

14 repliesLast updated: Nov 29, 2025

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:

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:

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

Was this answer helpful?

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.

Related contributions