🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Troubleshooting content loading issue in Studio with custom desk structure

11 replies
Last updated: Feb 3, 2022
I have a project that I haven’t touched for a bit. My client content editors let me know this morning that some of the content on the site was no longer showing up. I logged into the Studio, and while the desk structure is all there, I only get the loading spinner when I try to see any document lists.
I upgraded Studio from 2.21.9 to 2.26.0 and deployed, but that didn’t make a difference.

When I put a GROQ query into Vision, I can see the output. But something appears to be broken with the API document list query in Studio. I’ve tried multiple browsers with the same result. Any suggestions as to my next troubleshooting step?
Feb 3, 2022, 5:12 PM
Thanks for the quick reply, Rachael! I am using a custom desk structure.
Feb 3, 2022, 5:29 PM
It sounds like something's not resolving, then. I think there were some changes to Structure Builder in between those versions if I recall correctly. Do you mind sharing your structure?
Feb 3, 2022, 5:33 PM
Sure! Here it is:

import S from '@sanity/desk-tool/structure-builder'
import { FaFirstAid, FaWpforms, FaMapMarkedAlt } from "react-icons/fa";
import { RiMapPinUserFill, RiGlobeFill } from "react-icons/ri";
import { MdLocationCity, MdLibraryBooks } from "react-icons/md";
import { GoSettings } from "react-icons/go";

const hiddenDocTypes = listItem =>
  !['category','siteSettings','story'].includes(listItem.getId())

export default () =>
  S.list()
    .title('Content')
    .items([
      S.listItem()
        .title('Stories')
        .icon(RiMapPinUserFill)
        .schemaType('story')
        .child(S.documentTypeList('story').title('Stories')),
      S.listItem()
        .title('Places')
        .icon(RiGlobeFill)
        .child(
          S.list()
          .title('Place Types')
          .items([
            S.listItem()
            .title('Cities')
            .icon(MdLocationCity)
            .schemaType('city')
            .child(
              S.documentTypeList('city').title('Cities')
            ),
            S.listItem()
            .title('Refugee Camps')
            .icon(FaFirstAid)
            .schemaType('camp')
            .child(
              S.documentTypeList('camp').title('Refugee Camps')
            )
          ])
        ),

      S.listItem()
      .title('Pages')
      .icon(MdLibraryBooks)
      .child(
        S.list()
        .title('Individual Pages')
        .items([
          S.listItem()
            .title('Explore the Map')
            .icon(FaMapMarkedAlt)
            .child(
              S.editor()
                .id('explore')
                .schemaType('explore')
                .documentId('explore')
            ),
          S.listItem()
            .title('Share Your Story')
            .icon(FaWpforms)
            .child(
              S.editor()
                .id('share')
                .schemaType('share')
                .documentId('share')
            )
          ])
        ),

      S.listItem()
        .title('Settings')
        .icon(GoSettings)
        .child(
          S.editor()
            .id('siteSettings')
            .schemaType('siteSettings')
            .documentId('siteSettings')
        ),
    ])
Feb 3, 2022, 5:34 PM
Sure! Here it is:

import S from '@sanity/desk-tool/structure-builder'
import { FaFirstAid, FaWpforms, FaMapMarkedAlt } from "react-icons/fa";
import { RiMapPinUserFill, RiGlobeFill } from "react-icons/ri";
import { MdLocationCity, MdLibraryBooks } from "react-icons/md";
import { GoSettings } from "react-icons/go";

const hiddenDocTypes = listItem =>
  !['category','siteSettings','story'].includes(listItem.getId())

export default () =>
  S.list()
    .title('Content')
    .items([
      S.listItem()
        .title('Stories')
        .icon(RiMapPinUserFill)
        .schemaType('story')
        .child(S.documentTypeList('story').title('Stories')),
      S.listItem()
        .title('Places')
        .icon(RiGlobeFill)
        .child(
          S.list()
          .title('Place Types')
          .items([
            S.listItem()
            .title('Cities')
            .icon(MdLocationCity)
            .schemaType('city')
            .child(
              S.documentTypeList('city').title('Cities')
            ),
            S.listItem()
            .title('Refugee Camps')
            .icon(FaFirstAid)
            .schemaType('camp')
            .child(
              S.documentTypeList('camp').title('Refugee Camps')
            )
          ])
        ),

      S.listItem()
      .title('Pages')
      .icon(MdLibraryBooks)
      .child(
        S.list()
        .title('Individual Pages')
        .items([
          S.listItem()
            .title('Explore the Map')
            .icon(FaMapMarkedAlt)
            .child(
              S.editor()
                .id('explore')
                .schemaType('explore')
                .documentId('explore')
            ),
          S.listItem()
            .title('Share Your Story')
            .icon(FaWpforms)
            .child(
              S.editor()
                .id('share')
                .schemaType('share')
                .documentId('share')
            )
          ])
        ),

      S.listItem()
        .title('Settings')
        .icon(GoSettings)
        .child(
          S.editor()
            .id('siteSettings')
            .schemaType('siteSettings')
            .documentId('siteSettings')
        ),
    ])
Feb 3, 2022, 5:34 PM
Nothing is immediately jumping out to me with this. I'll have to play around with it. Could you share your Studio's schema folder with me? Feel free to DM it if you don't want it to be public.
Feb 3, 2022, 5:59 PM
I’ll be happy to do that. I’ll DM you.
I’ve been poking around a bit more on slack and in my files. Is
@sanity/components
version 2.14.0 the most recent? That’s what’s in my package.json.
Feb 3, 2022, 6:00 PM
Ok I was able to get your schemas/desk up and running. Looks like there's nothing inherently wrong with your structure. Are there any errors or anything in your console when you get this infinite spinning?
Feb 3, 2022, 6:58 PM
Oh and can you export a copy of your dataset and DM it to me?
Feb 3, 2022, 7:03 PM
I did eventually see a console error. I’ll DM it to you. Oh, and my spinner eventually gave me an error in the studio: Error: 
Could not establish EventSource connection
Feb 3, 2022, 7:06 PM
Ok, everything looks like it's working for me in both local and deployed Studios with your data. Just to see if it kickstarts everything, can you try undeploying the Studio, deleting your node modules with
rm -rf node_modules
, reinstalling with
npm i
, then redeploying?
Feb 3, 2022, 7:29 PM
Hmmm… sadly, that didn’t seem to make a difference. I’ve also cleared all my browsing data and turned off all extensions in Chrome.
Feb 3, 2022, 7:42 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?