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

NextJs Preview Mode Causing Lags and Timeouts with Browser Unresponsive Error

8 repliesLast updated: Nov 29, 2025

Hi! Preview in NextJs makes everything slowAnyone else struggling with big lags and timeouts when using the preview function? Happens when I use the preview button in the Studio and using the preview link to the site. Happens in both locally and production environment. If I wait long enough I get a "Page unresponsive" error from the browser
Only way to make it disappear is deleting the preview-cookie (and therefore not being in preview anymore)

Using the "NextJs with comments"-starter setup
AI Update

I can see you're experiencing the exact issue that was discussed in a community thread from 2022. The good news is there's a straightforward solution!

The Quick Fix

Update your next-sanity package to the latest version. The issue you're describing was caused by usePreviewSubscription running too aggressively in older versions of next-sanity (specifically version 0.4.0 and earlier). According to the community discussion, updating from 0.4.0 to 0.5.2 (or later) resolved this exact issue.

npm install next-sanity@latest
# or
yarn add next-sanity@latest

Why This Happens

The older implementation of usePreviewSubscription had performance issues where it would continuously query your content in an inefficient way, causing the browser to become unresponsive. This was particularly noticeable when using the preview button in Studio or accessing preview links.

Modern Approach: Consider Migrating to Live Content API

If you're still using the older preview setup with usePreviewSubscription, you might want to consider migrating to Sanity's newer Live Content API. This is the modern, production-ready approach that:

The Live Content API uses sanityFetch and SanityLive utilities instead of usePreviewSubscription, providing a much more efficient implementation.

Immediate Steps

If updating the package doesn't completely resolve the issue, feel free to share more details about your setup (Next.js version, how you're implementing preview mode) and the community can provide more specific guidance!

Show original thread
8 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