Issue with newly imported dataset not reflecting in Sanity CMS modules
14 replies
Last updated: Sep 14, 2022
E
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
E
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
S
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
E
Hey
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
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 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 exportand then imported the development dataset into the production dataset with the command
sanity dataset import data.ndjson production --replace
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
S
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.
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
E
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
K
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
S
Hello
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 đ„°
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
K
This is the version panel that I am referring to.
Sep 12, 2022, 9:11 AM
S
Yeah I know it đ But what is the issue with it?
Sep 12, 2022, 9:13 AM
K
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
K
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
S
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
K
Got it! Thank you! âșïž
Sep 13, 2022, 8:21 AM
E
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.