
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, real-time live preview absolutely works in dev environments and on localhost! Based on the guide you're following, here's what you need to know:
The Visual Editing setup with Presentation tool is specifically designed to work in your local development environment. When you visit http://localhost:3000/studio/presentation, it should:
If it's not updating in real-time, here are the most likely culprits:
useLiveQuery HookThe guide shows you need to wrap your components with the useLiveQuery hook from next-sanity/preview. Make sure you have preview wrapper components like:
// PostsPreview.tsx
import { useLiveQuery } from "next-sanity/preview";
export default function PostsPreview({ posts = [] }) {
const [data] = useLiveQuery(posts, POSTS_QUERY);
return <Posts posts={data} />;
}The Presentation tool needs to successfully activate draft mode by visiting your /api/draft route. Check that:
SANITY_API_READ_TOKEN is set in .env.local./src/pages/api/draft.tsVisualEditing ComponentMake sure you have the <VisualEditing /> component from @sanity/visual-editing/next-pages-router in your _app.tsx:
import { VisualEditing } from "@sanity/visual-editing/next-pages-router";
// Should be rendered when draftMode is true
<VisualEditing />This component contains the useLiveMode hook that actually listens for content changes from the Presentation tool.
Verify your client configuration in ./sanity/lib/client.ts has stega enabled for preview:
stega: {
enabled: previewToken ? true : false,
studioUrl: '/studio',
}Ensure your _app.tsx conditionally wraps your app with the PreviewProvider when draft mode is active. This provider includes the LiveQueryProvider that enables real-time updates.
You do not need to deploy anything for this to work locally. The whole point of this setup is to give content editors a live preview experience during local development and in production.
If you're still having issues after checking these:
/api/draft (check Network tab)The real-time updates should work perfectly on localhost once all the pieces are connected! The guide you're following is specifically designed for local development first, so there's no reason it shouldn't work before deployment.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store