Issue with grouping site setting singletons in their own panes in Sanity.io

5 replies
Last updated: Mar 8, 2021
Hello, I am working on grouping site setting singletons in their own panes and I have been following the instructions here: https://www.sanity.io/docs/manually-group-items-in-a-pane but I am getting this message when I try to view one of he sub items:
Structure item is missing required type property.
Here is my code in deskStructure.js:

import S from '@sanity/desk-tool/structure-builder';
import { MdSettings as icon } from 'react-icons/md';


export default () =>
  S.list()
    .title('Content')
    .items([
      S.listItem()
        .title('Site Settings')
        .icon(icon)
        .child(
          S.list()
            .title('All Settings')
            .items([
              S.listItem()
                .title('Metadata')
                .child([
                  S.document()
                    .schemaType('siteSettings')
                    .documentId('siteSettings')
                ])
            ]),
        ),
      ...S.documentTypeListItems().filter(listItem => !['siteSettings'].includes(listItem.getId()))
    ])
Can anyone help me understand what I am doing wrong?
Mar 8, 2021, 2:51 PM
Hi User, could you share your schema definitions for your
siteSettings
document type?
Mar 8, 2021, 3:28 PM
Hey User, your
.child()
has array square brackets in it for the meta data child document. It should just be a single item with S.document()
Mar 8, 2021, 3:34 PM
This is currently working in a local studio for me: (just removed the [])
import S from '@sanity/desk-tool/structure-builder';
import { MdSettings as icon } from 'react-icons/md';

export default () =>
  S.list()
    .title('Content')
    .items([
      S.listItem()
        .title('Site Settings')
        .icon(icon)
        .child(
          S.list()
            .title('All Settings')
            .items([
              S.listItem()
                .title('Metadata')
                .child(
                  S.document()
                    .schemaType('siteSettings')
                    .documentId('siteSettings')
                )
            ]),
        ),
      ...S.documentTypeListItems().filter(listItem => !['siteSettings'].includes(listItem.getId()))
    ])
Mar 8, 2021, 3:35 PM
Thanks
user T
! That was it!
Mar 8, 2021, 5:22 PM
Awesome! Glad that fixed it!
Mar 8, 2021, 6:30 PM

Sanity– build remarkable experiences at scale

Sanity is a modern 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?