Unlock seamless workflows and faster delivery with our latest releases – get the details

Issue with newly imported dataset not reflecting in Sanity CMS modules

14 replies
Last updated: Sep 14, 2022
Hello all! This morning we launched our new brand to our Sanity CMS powered site 🎉 . We have run into something interesting. When we started the brand work we imported our production dataset into our development dataset to start making changes that weren’t live to the public. This morning we imported that development dataset we worked on to our production dataset using the CLI . The website is accurate in every way to the dataset we deployed, however, the modules in the Sanity CMS when targeting the new production dataset still reflect the old production dataset, not the one that was newly imported. I don’t know how the Sanity CMS picks up the dataset import, but this wasn’t an issue when we imported production into development the first time. Any ideas how we can get our CMS up to date?
Sep 6, 2022, 7:13 PM
I have tried a redeploy of the Sanity CMS, but this had no effect. I admittedly don’t fully understand how Sanity CMS utilizes the dataset or if there’s some caching going on somewhere.
Sep 6, 2022, 7:15 PM
could you give us a mote detailed info around your datasets and how the “new production dataset still reflect the old production dataset” looks like?This could be caused by so many things, so the more you can share the better
Sep 8, 2022, 3:16 PM
Hey
user J
thanks for the reply!Datasets: We have two separate datasets, development and production. When we did our brand relaunch we had our content team make updates exclusively to our development dataset. There were breaking changes in the brand relaunch that we didn’t want to break our public facing website (new modules, assets, etc
).

What we did:
1. Create a development instance of our website complete with a development dataset, a sanity instance, and a gatsby frontend. This was an exact replica of the production dataset, sanity instance, and gatsby front end.
2. Use these development resources or “development environment” to make updates to the development dataset, gatsby frontend and sanity instance.
3. On the day of the launch. Merged changes from development to production for the sanity instance and gatsby front end. Exported the current development dataset using the command
sanity dataset export
and then imported the development dataset into the production dataset with the command
sanity dataset import data.ndjson production --replace
where the data.ndjson was the data we just exported from the development dataset.4. After doing so we viewed our gatsby site and it was identical to the development gatsby site meaning it built the website with the production dataset that we just imported from development. When we go into the Sanity CMS however, the modules still reference the content that was supposedly overwritten by the import from development into production. As an example our content changed from “The modern medical home for women” to “The new standard of care for women”, but within the CMS the module still says “The modern medical home for women” despite the live website showing the new tagline.
5. After this happened we tried redeploying the sanity instance and GraphQL API, but neither seems to have fixed the issues in the CMS.
Adding my colleague
user L
to follow the thread here.
Sep 8, 2022, 7:34 PM
This seems very strange
 And if you query the content in Vision, it’s the new one, but in the studio it shows the old data? Could you also check the versions panel of documents as well as any more things like console logs etc. and report back?
The investigation is on
đŸ•”ïžâ€â™€ïž
If you’re comfortable with it, you can also invite me into your project until we find whats going on.
Sep 8, 2022, 8:10 PM
Thanks
user J
,
user L
will take a look. We definitely saw the version change after the import. I’m not familiar with “Vision” you mean by querying the GraphQL API directly?
Sep 12, 2022, 4:21 AM
Hi! Nice to meet you
user J
. Sorry for late response. I figured out the problem. The thing was that before importing development dataset to production we had unpublished content in production dataset and because of that we could see new content in gatsby hosted website but the content shown in sanity CMS was the unpublished(draft) content. The only thing that looks strange is that in version history panel it shows importing new content as latest change but in view draft content(which was done before importing data) is being shown.
Sep 12, 2022, 7:16 AM
Hello
user L
👋Wonderful you figured it out!
Drafts would habe been my guess as well this is why I asked about vision and querying the data in the studio to see if drafts show up there.
I am unsure though, what you mean with the history panel.... Could you give more info around this please (I love screenshots
😉)
And btw. Since there are a lot of galls in here as well, we don't use guys so much as folks, you all etc
đŸ„Č I would be really thankful as well as all other fem and non-binary people in this community đŸ„°
Sep 12, 2022, 8:27 AM
This is the version panel that I am referring to.
Sep 12, 2022, 9:11 AM
Yeah I know it 😎 But what is the issue with it?
Sep 12, 2022, 9:13 AM
I am not sure that it is an issue but the latest version(newly imported dataset) doesn't match the shown content in CMS.
Sep 12, 2022, 9:29 AM
I guess it should work that way because of drafts. If it is, then everything is clear to me now)
Sep 12, 2022, 9:30 AM
Yeah drafts will always be shown first 🙂 If you have a green (aka active) Publish button, you are looking at a draft. In that case you can batch delete any drafts from your dataset via CLI command and a groq query, since you’re able to query for only drafts via the vision. BUT PLEASE BE CAREFUL 😉 deletions can be hard to get back
Sep 12, 2022, 4:11 PM
Got it! Thank you! â˜ș
Sep 13, 2022, 8:21 AM
Thank you so much for the help
user J
and
user L
for the investigation!
Sep 14, 2022, 4:59 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?