Preview Mode shows published version instead of draft changes in Next.js
Based on your description, it sounds like your preview mode is working for unpublished drafts but not showing draft changes to already published documents. This is a common issue that usually comes down to how your queries are fetching data and which perspective you're using.
Here's what's likely happening: When you have a published document with draft changes, Sanity stores two versions - the published document (e.g., post-123) and the draft version (e.g., drafts.post-123). If your queries aren't properly prioritizing the draft version, you'll only see the published content.
The fix: Make sure you're using the previewDrafts perspective in your draft mode queries. This perspective specifically prioritizes draft documents over published ones when both exist.
In your data fetching code (where you're using @sanity/client or similar), you should have something like:
const client = createClient({
// ... your config
useCdn: false, // Important: disable CDN for draft mode
perspective: 'previewDrafts', // This is the key setting
token: process.env.SANITY_API_TOKEN, // Required for draft access
})The perspective: 'previewDrafts' setting tells Sanity to return draft versions when they exist, falling back to published versions when no draft is present.
Common gotchas to check:
Make sure your read token has the proper permissions to access draft documents. Without the right token, the API will fall back to published content even with the correct perspective.
Verify that when draft mode is enabled in Next.js, you're actually switching to use this authenticated client. You might have separate client configurations for production vs. preview that need to be conditional based on
draftMode().isEnabled.Ensure
useCdn: falseis set when fetching draft content - the CDN only serves published content.
The Sanity documentation on perspectives and Draft Mode with Next.js cover this in detail, particularly around how the previewDrafts perspective works with draft and published documents. The key is that without the right perspective setting, your queries will return both the draft AND published versions (or just published), rather than prioritizing the draft as you want for preview mode.
Show original thread2 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.