Issue with newly imported dataset not reflecting in Sanity CMS modules
Congratulations on the launch! đ
The issue you're experiencing is likely related to Studio configuration, not a data import problem. Since your website is showing the correct content, the dataset import was successful. The Studio showing old data suggests it might be pointing to the wrong dataset or there's a configuration mismatch.
First: Verify Your Studio Configuration
Check your sanity.config.ts (or sanity.config.js) file to ensure it's pointing to the correct dataset. According to the defineConfig documentation, your configuration should look like this:
import { defineConfig } from 'sanity'
export default defineConfig({
projectId: 'your-project-id',
dataset: 'production', // Make sure this matches your target dataset
// ... rest of config
})If you're using environment variables to manage different datasets, verify that your production Studio is using the correct environment configuration. Check for .env files that might be overriding your dataset setting:
SANITY_STUDIO_API_DATASET="production"
Understanding Dataset Imports
When you use the CLI to import a dataset (with commands like sanity dataset import), you're updating the Content Lake - the actual data storage. Your Studio then queries this data through Sanity's API. The datasets documentation explains that datasets are "named isolated collections of schemaless JSON documents" that are completely separate from each other.
Troubleshooting Steps
Verify the import completed successfully: Check your CLI output for any errors during the import process
Confirm you're viewing the correct dataset: If your Studio supports multiple datasets or workspaces, make sure you haven't accidentally switched to a different one
Redeploy your Studio: If your Studio is hosted on Sanity's platform, try redeploying it:
sanity deployCheck for dataset name mismatches: Ensure the dataset name in your Studio config exactly matches the dataset you imported to (including any differences in capitalization or spacing)
Restart your local development server: If you're running the Studio locally with
sanity dev, stop and restart the development server
About the --replace Option
When using sanity dataset import with the --replace flag, it completely replaces the target dataset's contents with the imported data. This is a destructive operation that removes all existing documents before importing the new ones. The fact that your website shows correct data confirms this worked as expected.
The Studio should immediately reflect changes in the Content Lake since it queries the data in real-time through the API. If it's not showing updated content, it's almost always a configuration issue rather than a data synchronization problem.
If none of these steps resolve the issue, double-check that you imported to the exact dataset name that your production Studio is configured to use - even small typos or naming differences would cause this exact symptom you're seeing.
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.