Sanity changes visible in preview but not publishing
This sounds like a classic draft vs. published content issue! When you're seeing changes in preview but not in production, it typically means your preview is looking at draft documents while your production site is querying only published documents.
Here's what's likely happening:
The Draft/Published System
When you make changes to content in Sanity Studio, those changes are saved as draft documents with an ID prefixed by drafts. (like drafts.post-123). The published version remains unchanged until you explicitly click the "Publish" button in the Studio. This means both versions can exist simultaneously.
Common Causes & Solutions:
Changes weren't published - The most common reason! After editing in the Studio, make sure you're clicking the "Publish" button (not just saving). Look for the green "Publish" button in the document editor.
Your production queries are using the wrong perspective - If you're using the newer API version 2025-02-19, the default perspective changed to
published(which excludes drafts). Your preview might be usingpreviewDraftsperspective while production usespublished.GROQ queries filtering out drafts - Check if your production queries explicitly exclude drafts with patterns like:
*[_type == 'post' && !(_id in path("drafts.**"))]Stale project after long inactivity - Since you mentioned this project hasn't been used for a while, try:
- Refreshing your Studio (
sanity upgradeif needed) - Checking if your frontend is still properly connected to the right dataset
- Verifying your API token/credentials are still valid
- Refreshing your Studio (
Quick Debug Steps:
- In Studio, open a document that should be published and verify it shows "Published" status (not just "Saved")
- Try querying your content directly via Vision plugin in Studio to see what's actually in your dataset
- Check your frontend code to see which perspective it's using for production queries
If you're still stuck, checking the Vision plugin will quickly show you whether the published documents exist in your Content Lake or if they're still only in draft state.
Show original thread7 replies
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.