Issue with changes not reflecting in queries after adding an editor member to the project.

11 replies
Last updated: Aug 28, 2023
Hi everyone. I am developing a web app and I am using Sanity to provide some content. I have two pages. Everything was working fine until I added an editor member to the project. For some reason now the changes to a document are not showing in the queries. I am changing some content and then publishing the document, then testing out the changes on the Sanity Studio vision mode and the latest changes are not reflecting...am I doing something wrong? or perhaps missing out on some information regarding the editor? Thank you.
AI Update

I think I've found your issue! This is likely related to a recent change in Sanity's API regarding perspectives.

The Vision tool in Sanity Studio uses the Content Lake API, and there was a breaking change in API version 2025-02-19 where the default perspective changed from raw to published. This is probably what's happening to you.

What's going on with perspectives?

In Sanity, when you edit and save a document, it creates a draft version (with an ID like drafts.my-document-id). When you publish, the draft becomes the published document. Perspectives control which version of documents you see:

  • raw - Shows ALL documents (both drafts and published)
  • published - Shows ONLY published documents (no drafts)
  • previewDrafts - Prioritizes drafts over published when both exist

Why this might have started happening

If your project recently updated to use the newer API version (which could have happened automatically or when the editor was added), Vision might now be using the published perspective by default instead of raw. This means if there's any issue with the publish step, you won't see your changes.

How to troubleshoot

  1. Check the perspective in Vision: In the Vision tool, look for a perspective selector (usually in the toolbar or params section). Try explicitly setting the perspective:

    • Add perspective=raw to your Vision query parameters
    • Or try perspective=previewDrafts to see if your draft changes appear
  2. Verify the document published correctly: In Studio, check if the document shows as published (no "Publish" button visible, and no draft indicator). Sometimes publish actions can fail silently.

  3. Check for draft documents in your query: Try this GROQ query in Vision to see both versions:

    *[_type == "yourDocumentType"] {
      _id,
      _type,
      // your other fields
    }

    If you see both drafts.document-id and document-id, the draft might not have published properly.

  4. Try re-publishing: Sometimes clicking "Publish" again can resolve stuck draft states.

The timing with adding an editor member is likely coincidental, unless that action triggered some project configuration changes or an automatic update to a newer API version. The editor role itself shouldn't affect how documents publish or how queries work.

Quick fix: Try adding perspective=raw to your Vision query parameters and see if your changes show up. If they do, that confirms the perspective change is the issue!

Can you provide more context about your app?
Hi, I am developing a Shopify app with remix.js, but it should not matter. I have created an schema and deployed it to Sanity. I created a couple documents and added a team member as an editor. For some reason the content that is being showed in the desk does not match what the Sanity Vision query outputs. It is liked it is outputing an older and cached version of the document...
It likely has nothing to do with the editor being added and is entirely coincidental. So, yes, we do need to see how you’re consuming content in your app.
Sure, seems weird the Sanity Studio editor would retrieve wrong data but yes, here is the call:
export async function loader({ context }) {

const about = await context.sanity.query({
`query:
*[_type == "page" && title == 'About'][0]{

content,

"aboutImage": image{alt, asset->{url}},

quote,

"quoteImage": quoteImage{alt, asset->{url}},

}
,`
cache: CacheNone(),

})

return { about }

}
export async function loader({ context }) {

const about = await context.sanity.query({
`query:
*[_type == "page" && title == 'About'][0]{

content,

"aboutImage": image{alt, asset->{url}},

quote,

"quoteImage": quoteImage{alt, asset->{url}},

}
,`
cache: CacheNone(),

})

return { about }

}
My sanity client:
const sanity = createSanityClient({

cache,

waitUntil,

// Optionally, pass session and token to enable live-preview

preview:

env.SANITY_PREVIEW_SECRET && env.SANITY_API_TOKEN

? {

session: PreviewSession,

token: env.SANITY_API_TOKEN,
`// Optionally, provide an alternative to the default
previewDrafts
perspective when in preview mode`
// See <https://www.sanity.io/docs/perspectives>

// perspective: "raw"

}

: undefined,

// Pass configuration options for Sanity client

config: {

projectId: env.SANITY_PROJECT_ID,

dataset: env.SANITY_DATASET,

apiVersion: env.SANITY_API_VERSION ?? '2023-03-30',

useCdn: process.env.NODE_ENV === 'production',

}

})
user M
Hi!, any updates on this?
user M
I cannot update content on my Sanity Studio, this seems quite critical, please help.
user M
Thank you for everything, the problem was I was using _type === "page", referencing older documents that were probably saved from previous versions. I believe this was my issue, so you can close this.

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?