Issue with updating the Post schema in Sanity Studio.

7 replies
Last updated: Feb 9, 2023
Hi everyone,
I'm pretty new to web development, and I'm following a crash course by User where he builds a few apps using Next.JS, and the first one is a blog within Sanity.
My issue is, everything was working smoothly, until I tried to update the Post schema in the studio.
My studio is running in localhost:3333 normally, I can create posts, authors, query them using vision, however, when I modify anything in my app folder/schemas/post.ts (I'm using typescript), it does not update in the studio. I tried including a description field, but my studio does not show it. I even tried changing the title value in the title field to pt-br, no luck too.
AI Update

This is a frustrating but common issue! The good news is it's usually something simple. When your Sanity Studio isn't reflecting schema changes, here are the most common causes and solutions:

1. Hard Refresh Your Browser

The most common culprit is browser caching. Even though the dev server has Hot Module Replacement (HMR), sometimes your browser holds onto the old schema. Try:

  • Hard refresh: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
  • Clear cache: Open DevTools → Network tab → check "Disable cache" and refresh

2. Restart the Dev Server

Sometimes HMR doesn't catch schema changes properly. Stop your dev server (Ctrl+C) and restart it:

npm run dev
# or
sanity start

3. Check Your File Location

Make sure you're editing the correct schema file. In a typical Next.js + Sanity setup, there can be confusion about where schemas live:

  • Standalone Studio: Schemas are usually in /schemas/ or /schemaTypes/
  • Embedded Studio (Studio v3 in Next.js): Schemas might be in /sanity/schemas/ or /app/schemas/

Double-check that the schema file you're editing is actually being imported in your Sanity configuration file.

4. Verify Schema is Imported

Open your sanity.config.ts (or sanity.config.js) and make sure your post schema is properly imported and included in the types array. This is the central configuration file where all schemas must be registered:

import {defineConfig} from 'sanity'
import {post} from './schemas/post'
import {author} from './schemas/author'

export default defineConfig({
  // ... other config
  schema: {
    types: [post, author], // Make sure your schema is here!
  },
})

5. Check for TypeScript/JavaScript Errors

Look at your terminal where the dev server is running. If there's a syntax error in your schema file, it won't compile and the changes won't show up. The terminal will usually show compilation errors in red.

6. Port Conflicts

Since you mentioned localhost:3333, make sure nothing else is using that port. If another process is occupying it, your Studio might not be running the latest code. You can check by completely stopping the server and restarting it.

Quick Test

Try making a very obvious change to test if HMR is working at all:

{
  name: 'title',
  title: 'TESTING 123', // Make it obvious
  type: 'string'
}

If this doesn't show up after a hard refresh, it confirms the schema isn't being picked up.

Still Not Working?

If none of the above works, try this nuclear option:

  1. Stop the dev server
  2. Delete node_modules and any .sanity cache folders
  3. Run npm install again
  4. Restart the dev server

This usually resolves any stubborn caching or module resolution issues that can happen during development.

Let us know which solution worked for you, or if you're still stuck, share your sanity.config.ts file structure and we can help debug further!

IIRC, Sonny's Next13 Blog with Sanity is built using localhost:3000
But if you have it running on 3333 normally, I'm not sure what would be preventing the updates to show
The dev server is running in localhost:3000, where I see the page we're building, but the studio runs in localhost:3333.
If the Studio isn’t updating, it seems like your server either isn’t actually running or you’ve somehow ended up on a deployed version of your Studio.
I created the app using:
npx create-next-app --example with-tailwindcss sanity-yt-demo
After, I installed Sanity inside this sanity-yt-demo folder using Sonny's recommendation:

npm install -g @sanity/cli
After, I started the project using
sanity init
and named it crash-course.
Running
npm run dev
in the sanity-yt-demo folder opens my project in localhost:3000, and if I change to directory of the sanity project (crash-course) and run
sanity start
it opens the studio in localhost:3333, but no changes are done when I modify the post.ts file in the schemas folder (inside crash-course folder).I'm really lost, if somebody has any clue what to do, I appreciate it.
Well, well, well, I tried rebooting everything for the fourth time and now it's working. Go figure.
Thank you everyone for the support!
The old hard reset! Glad it’s working now!

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.

Was this answer helpful?