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

Sanity v3: Studio crashes when modifying split desk structure parts

6 repliesLast updated: Dec 2, 2025

Hey Sanity Team, I just upgraded a test studio to v3.. I am trying to split my desk structure up into parts, but I am not sure if I am doing this correctly (not using typescript).. This is a similar layout to the Hydrogen Studio starter. This MIGHT be a bug with the studio, but currently if you split your desk structure up into parts, then change something within one of those parts the studio crashes. Here is what I have:`sanity.config.js`:

plugins: [
  deskTool({
    structure
  }),
]
Then my
structure
which is just
index.js
in my /Desk folder:
import { home } from './home'

// Doc types
const hiddenDocTypes = (listItem) => {
  const id = listItem.getId()

  if (!id) {
    return false
  }

  return ![
    'homePage',
    'media.tag' // Media plugin
  ].includes(id)
}

export const structure = (S) =>
  S.list()
    .title('Content')
    .items([
      home(S),

      // Filter out docs already defined above
      ...S.documentTypeListItems().filter(hiddenDocTypes)
    ])
And finally my
home.js
structure schema:
// Icons
import { HouseLine } from 'phosphor-react'

export const home = (S) =>
  S.listItem()
    .title('Home')
    .icon(HouseLine)
    .child(
      S.editor()
      .title('Home Page')
      .schemaType('homePage')
      .documentId('homePage')
    )
Again, I am not sure if I am doing this correctly as there is really no other example of this other than the Shopify Hydrogen Studio.. If I make a change in the
home.js
my studo will crash.
AI Update

Your code structure looks correct - you're following the same modular pattern used in the Hydrogen starter. However, the crash you're experiencing when editing home.js isn't documented as expected behavior, and this appears to be a potential bug worth investigating.

Your setup follows best practices:

Your approach of splitting structure files is valid according to the Structure Builder documentation. The pattern you're using - exporting functions that accept the Structure Builder (S) parameter and composing them together - is the correct way to organize structure code:

// desk/home.js
export const home = (S) =>
  S.listItem()
    .title('Home')
    .icon(HouseLine)
    .child(
      S.editor()
        .title('Home Page')
        .schemaType('homePage')
        .documentId('homePage')
    )

// desk/index.js
import { home } from './home'

export const structure = (S) =>
  S.list()
    .title('Content')
    .items([
      home(S),
      ...S.documentTypeListItems().filter(hiddenDocTypes)
    ])

This matches the recommended patterns from the Structure Builder guide.

Troubleshooting steps:

Since crashes on file changes aren't documented behavior, try these approaches:

export const home = (S) =>
  S.listItem()
    .title('Home')
    .child(S.documentTypeList('homePage'))

Report this issue:

Since this behavior isn't documented and your code follows established patterns, I'd recommend reporting this:

Include details like your Studio version, Node version, and the exact error messages you're seeing. The Sanity team can then determine if this is a bug with hot module reloading when structure files are split across modules, or if there's a specific configuration issue causing the problem.

Your code organization is solid - the issue appears to be with how the development server handles these particular file updates, not with your structure implementation.

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