Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Issues with updating documents and schema in Sanity Studio

23 replies
Last updated: Mar 24, 2022
I tried to add a a few new documents to the schema. I also added new types to the existing documents on my schema. The existing documents updated on the localhost:3333 studio but did not update on the sanity.io/manage site. Also, the new documents added did not update on the localhost nor on the sanity.io/manage site. I have imported them in the schema.js file as shown in the image but am not understanding why the new documents are not updating, image below for one new document created, both on the localhost and on the sanity.io/manage site? Any thoughts?
Mar 23, 2022, 8:00 PM
When you say sanity.io/mange , do you mean your deployed Studio?
Mar 23, 2022, 8:25 PM
Yes, deployed studio
Mar 23, 2022, 8:27 PM
Got it. You have to redeploy your studio in order for changes made to the Studio itself to be reflected. Your content will be updated in real time, though.
Mar 23, 2022, 8:29 PM
That;s cool. I did run a yarn build again, is that how you redeploy?
Mar 23, 2022, 8:30 PM
That could be the reason I do not see the preview on the deployed studio also.
Mar 23, 2022, 8:31 PM
sanity deploy
should do it.
Mar 23, 2022, 8:32 PM
great thank you for the help
Mar 23, 2022, 8:32 PM
You're welcome!
Mar 23, 2022, 8:32 PM
Well that definitely fixed my preview issue but it is has not fixed the issue with a new document. I tried with a simple document, image below but it is not working (creating the document in studio) on localhost .
Mar 23, 2022, 8:46 PM
A console.log in schema.js shows that is correctly importing into schema.js
Mar 23, 2022, 8:49 PM
Also, changing the 'name' property on one of the documents already loaded throws an error stating the " Schema type with 'old name' not found. Shouldn't this update? I think it is cache problem. Is there anyway to clear the cache in sanity?
Mar 23, 2022, 8:57 PM
in sanity?
Mar 23, 2022, 8:57 PM
You're likely using the old name somewhere in your schema.
Mar 23, 2022, 9:20 PM
No this was reduced to the simplest schema to test. I still cannot add any new documents.
Mar 23, 2022, 11:08 PM
So if i go to the create new document in the studio the documents appear but never show up on the ist?
Mar 23, 2022, 11:16 PM
If I'm understanding correctly, are you hoping to have a document (meaning, one that you added content to or published) show up in that first image?
If so, that list is only a shortcut to create a new document. Your content shows up in the desk below.

But let me know if that's not what you're looking for.
Mar 23, 2022, 11:25 PM
The documents are not being added to the list. I located them in the create new document window, but nothing is added to the list you are referring to
Mar 23, 2022, 11:28 PM
The content list on the desk
Mar 23, 2022, 11:28 PM
I even copied the movies schema from the docs and the same result. It doe s not show under the content list but it shows in the create a new documnt window so I know it is loading
Mar 23, 2022, 11:30 PM
My guess would be it has something to do with the preview and the resolveProductionUrl function. I tried to add it to my switch case to see if that was it but no luck, it is commented out as an example
Mar 23, 2022, 11:35 PM
The production url would only affect your preview, so it won't interfere with your desk. A few things to check: is the document added to schema.js? Do you have a custom desk structure that maybe doesn't include these types?
Mar 23, 2022, 11:57 PM
You can also share your repo and I can look over it if you like.
Mar 23, 2022, 11:57 PM
Thank you, I will give it a shot and let you know
Mar 24, 2022, 3:56 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?