Bug with opening Sanity Studio in different windows/tabs after v3 upgrade

9 replies
Last updated: Feb 14, 2023
Hi awesome people!
Since upgrading to v3, I've got a bug where I can no longer open Sanity Studio in different windows/tabs. When opening a second tab, the other tab's instance of Sanity Studio crashes with an error
Pane resolution error at index 0: List items with same ID found

My initial guess is that the schema is being loaded twice in the same environment and thus the list of schema types/names are then duplicated.

Any help fixing this is greatly appreciated!
Feb 14, 2023, 9:03 PM
What does the structure look like for the panes that cause this error?
Feb 14, 2023, 9:25 PM
I'm pretty sure the structure is breaking for the
Here's a section of my deskStructure.js:

// deskStructure.js

import interactives from './interactives'

const interactiveUnitListItems = []

export default (S) => {
  for (const key in interactives) {
    const document = interactives[key].document
    let documentListItem = S.listItem().title(document.title).child(S.documentTypeList(document.name))

  const interactiveUnitList = S.list().title('Interactive Units').items(interactiveUnitListItems)

  return S.list()
    .title('Main Menu')
      S.listItem().title('Content Config').child(S.documentTypeList('config')),

Feb 14, 2023, 9:43 PM
I can now confirm that
is indeed creating the problem.
So I think I need to find another way of creating a pane with its own array of list items.
Feb 14, 2023, 9:51 PM
What does your
array look like? It may be that youโ€™re generating list items for both draft and published versions of documents.
Feb 14, 2023, 10:07 PM
I have a folder
and we are importing this array from the `index.js`:

// schema/interactives/index.js

import distortion_picker_quiz from './distortion_picker_quiz'
import choice from './choice'
import learn_more from './learn_more'
import matching_game from './matching_game'
import quiz from './quiz'
import textbox from './textbox'
import yes_no from './yes_no'
import display_rich_text from './rich_text_display'

export default {
Feb 14, 2023, 10:13 PM
Can you try explicitly setting an
on each of your
Feb 14, 2023, 10:18 PM
That worked!
I am setting the id with just a random string:

let documentListItem = S.listItem()
Thank you
user M
!!! ๐Ÿ™ ๐Ÿ™ ๐Ÿ™ ๐Ÿ™
Feb 14, 2023, 10:28 PM
Feb 14, 2023, 10:36 PM
Heya! I ended up digging a bit further and finally got to the root of the problem!
It turns out in the
I was defining
const interactiveUnitListItems = []
OUTSIDE of the export block. When a new tab opens, the previous tab's export gets re-rendered, and the export block tries to re-append additional items to the
array. Since it is outside the export block, its state has not changed, and thus duplicate list item builders are added to it.
The final solution is to move the array definition into the export block, which will reset on every render.

Fun times!
Feb 14, 2023, 11:55 PM

Sanityโ€“ build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?