Fixing slow typing in Sanity Studio by setting up NextJS and Sanity correctly

4 replies
Last updated: May 30, 2024
Does anyone know how to disable auto-saving in Sanity Studio?I am experiencing very slow typing, because the studio is auto-saving every time I input a character in an input field. I know this has been an issue for some users in the past. This person fixed it by upgrading to Sanity version 3.35.2, but I'm using

"sanity": "^3.43.0",
"next-sanity": "^9.3.7",
AI Update

I totally understand your frustration with the slow typing experience! The good news is that Sanity Studio doesn't actually autosave on every single keystroke — there's no way to disable autosave because the lag you're experiencing isn't directly caused by saving behavior. Instead, the issue is typically related to performance bottlenecks elsewhere in your setup.

Based on the Sanity Answers thread and GitHub issue #7456, here's what's actually happening and how to fix it:

What's Really Causing the Lag

Sanity Studio debounces saves (waits for you to pause typing), so the keystroke lag is usually caused by:

  1. Performance regressions in certain Studio versions — Some versions between 3.50.0 and 3.56.0 had known performance issues
  2. Next.js integration issues — Running Studio embedded in Next.js dev mode can be slower than standalone
  3. Complex schemas or custom components — Heavy validation, custom input components, or deeply nested fields
  4. Portable Text with nested objects — This is particularly bad, as multiple users reported

Solutions That Have Worked

1. Update to the latest version
Since you're on 3.43.0, try updating to the latest Studio version. The team released v3.57.0 with up to 10x speed improvements (though that specific fix was for dev mode). More recent versions include additional performance fixes targeting the exact issue you're describing.

npm install sanity@latest

2. Try downgrading temporarily
If updating doesn't help, downgrade to 3.50.0 as a workaround while testing:

npm install sanity@3.50.0

3. Test Studio standalone
Run npx sanity dev directly instead of through your Next.js app to isolate whether it's a Next.js integration issue. If it's fast standalone, the problem is with your Next.js setup.

4. Check for the actual culprit
From the GitHub thread, one user discovered their setup was just incorrect — they fixed it by recreating their Next.js + Sanity project from scratch and copying over the code.

5. Build for production
Try running your Next.js app in production mode (npm run build && npm run start) — dev mode can be significantly slower.

Common Misconceptions

  • It's not syncing every keystroke to the cloud — Studio batches and debounces changes
  • Autosave can't be disabled — but you shouldn't need to since it's not the actual problem
  • The lag is particularly bad in Portable Text with nested objects — this is a known pain point

The Sanity team is actively working on performance improvements for these scenarios. If none of the above helps, I'd recommend sharing your schema configuration in the Sanity Community so folks can help identify specific bottlenecks!

It can’t be disabled. Can you share the schema for one of the documents that’s giving you issues?
Sure. Here is an article content schema (rich text).I'm noticing now that I get build errors that I don't get if I copy all my schemas into a different project and build that, so I might have set the project up wrong all together.


`export const articleContent = defineType({
  title: "Article Content",
  name: "articleContent",
  type: "array",
  of: [
    defineArrayMember({
      title: "Block",
      type: "block",
      // Styles let you define what blocks can be marked up as. The default
      // set corresponds with HTML tags, but you can set any title or value
      // you want, and decide how you want to deal with it where you want to
      // use your content.
      styles: [
        { title: "Normal", value: "normal" },
        { title: "H1", value: "h1" },
        { title: "H2", value: "h2" },
        { title: "H3", value: "h3" },
        { title: "H4", value: "h4" },
        { title: "Quote", value: "blockquote" },
      ],
      lists: [{ title: "Bullet", value: "bullet" }],
      // Marks let you mark up inline text in the Portable Text Editor
      marks: {
        // Decorators usually describe a single property – e.g. a typographic
        // preference or highlighting
        decorators: [
          { title: "Strong", value: "strong" },
          { title: "Emphasis", value: "em" },
        ],
        // Annotations can be any object structure – e.g. a link or a footnote.
        annotations: [
          {
            title: "URL",
            name: "link",
            type: "object",
            fields: [
              {
                title: "URL",
                name: "href",
                type: "url",
              },
            ],
          },
        ],
      },
    }),
    // You can add additional types here. Note that you can't use
    // primitive types such as 'string' and 'number' in the same array
    // as a block type.
    defineArrayMember({
      type: "imageWithCaption",
    }),
    defineArrayMember({
      type: "testimonial",
    }),
    defineArrayMember({
      type: "customerCase",
    }),
  ],
});
I can now confirm, it was set up incorrectly. I don't know what I did, but setting up NextJS and Sanity Studio from scratch and copying over all my code fixed both this issue and my build errors
Glad it was an easy-ish fix!

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?