đź”® Sanity Create is here. Writing is reinvented. Try now, no developer setup

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.
Aug 22, 2023, 9:43 AM
Can you provide more context about your app?
Aug 22, 2023, 5:21 PM
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...
Aug 23, 2023, 10:03 AM
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.
Aug 23, 2023, 4:15 PM
Sure, seems weird the Sanity Studio editor would retrieve wrong data but yes, here is the call:
Aug 23, 2023, 8:31 PM
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 }

}
Aug 23, 2023, 8:34 PM
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 }

}
Aug 23, 2023, 8:34 PM
My sanity client:
Aug 23, 2023, 8:34 PM
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',

}

})
Aug 23, 2023, 8:34 PM
user M
Hi!, any updates on this?
Aug 27, 2023, 8:13 PM
user M
I cannot update content on my Sanity Studio, this seems quite critical, please help.
Aug 28, 2023, 10:43 AM
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.
Aug 28, 2023, 11:28 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?