Joint session with Vercel: How to build intelligent storefronts (May 15th)

Content appears in preview then disappears after page loads

23 repliesLast updated: Dec 1, 2025

A completely unrelated question to my last one, but can anyone understand why my content is appearing in the preview and then promptly disappearing when the page finishes loading? Video here: https://www.dropbox.com/s/js2vxz0fpfnixjz/Screen%20Recording%202022-01-13%20at%2010.05.11.mov?dl=0
AI Update

Based on the video you shared, this looks like a classic issue where content loads initially and then disappears after the page finishes loading. This was a common problem with older Next.js preview implementations from around 2022.

Important note: The preview approach you're likely using (usePreviewSubscription from older versions of next-sanity) has been replaced with modern alternatives. The current recommended approaches for previewing draft content in Next.js are:

However, if you're still working with the older usePreviewSubscription pattern, the most common cause of content disappearing is:

Parameter name mismatches - Your GROQ query expects a variable name (like $slug) but your subscription hook is passing a different parameter name. When the subscription takes over from the initial getStaticProps data, it runs the query with incorrect parameters and returns null.

For example, if your query is:

*[_type == "page" && slug.current == $slug][0]

Your subscription params must use slug:

const { data: page } = usePreviewSubscription(pageQuery, {
  params: { slug: data?.page?.slug }, // Must match $slug in query
  initialData: data.page,
  enabled: preview,
});

Other common causes from that era:

My recommendation: If you're starting fresh or can refactor, migrate to the modern Draft Mode with Visual Editing approach. It's more reliable, better maintained, and provides a superior editing experience with live updates as you type. The old usePreviewSubscription pattern had various quirks that have been solved in the current implementation.

Show original thread
23 replies

Was this answer helpful?

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.

Related contributions