Sanity embedded studio popup overlay flashing on save in production (Vercel)
Good news! This exact issue was reported and fixed back in March 2024. The problem you're experiencing with the overlay flashing and reloading on every autosave in production is a known bug that was resolved in a Sanity Studio release.
The solution is simple: upgrade your Sanity package.
You mentioned you're on Sanity 3.35.0, and the fix was released around March 22, 2024 (likely version 3.36.0 or later). The issue was specifically in the sanity package, not next-sanity.
Run:
npm install sanity@latest
# or
yarn add sanity@latestThen redeploy to Vercel, and the flashing overlay issue should be resolved.
Why this happens: The problem occurs specifically in production environments (like Vercel) because of how the embedded Studio handles re-renders during autosave. In production builds, certain optimizations or caching behaviors can trigger unmounting/remounting of overlay components (like array inputs, reference selectors, etc.) when the document saves in the background. This causes the flash you're seeing and the frustrating focus loss.
The Sanity team addressed this in their release by improving how the Studio maintains component state during background saves, preventing those overlays from being unnecessarily torn down and rebuilt.
Your code setup looks fine - having the Studio in a client component with 'use client' and using NextStudio from next-sanity is the correct approach. The dynamic theme loading from themer.sanity.build is also a common pattern and shouldn't be causing this issue.
After upgrading, if you're still experiencing problems (unlikely), you might also want to update next-sanity to the latest version, but based on the community discussion I found, the fix was specifically in the core sanity package and resolved the issue completely for the original reporter.
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.