Error in starter project causes studio to become inaccessible
12 replies
Last updated: Aug 5, 2021
C
Hey šIām playing around with the starter project
Lifestyled: Editorial and E-Commerce and Iāve encountered an error making the studio inaccessible.I was playing around in the studio trying to remove some linked elements I believe and then it crashed.
As the error says thereās something with the multiple list items with the same ID, but Iām not sure what the
linked docs wants me to do. Can anyone lead me on the right path?Also, am I supposed to make my own error handling so that this kind of problem doesnāt occur, or is there something out of the box? If the studio was still accessible a content creator could fix it by setting the right linked elements instead of needing a software developer to fix it, so that would be optimal.
Lifestyled: Editorial and E-Commerce and Iāve encountered an error making the studio inaccessible.I was playing around in the studio trying to remove some linked elements I believe and then it crashed.
As the error says thereās something with the multiple list items with the same ID, but Iām not sure what the
linked docs wants me to do. Can anyone lead me on the right path?Also, am I supposed to make my own error handling so that this kind of problem doesnāt occur, or is there something out of the box? If the studio was still accessible a content creator could fix it by setting the right linked elements instead of needing a software developer to fix it, so that would be optimal.
Aug 5, 2021, 1:40 PM
E
I don't think that is ever supposed to happen unless you duplicate an entry using the API.
Aug 5, 2021, 2:19 PM
E
Do you recall what you did right before this happened? We're pretty robust when it comes to elegantly handling errors and you aren't supposed to be able to break the UI with any editing actions, unless there's a brittle configuration.
Aug 5, 2021, 2:22 PM
C
Iām very happy to hear that you shouldnāt be able to break the UI! It didnāt seem right to me at all.
I didnāt do anything through through the API. I had done some simple actions in the UI. In this starter example thereās some linked elements and I went to remove the linked
Iāll try and spin a new project of the same up again and see if I can replicate it
I didnāt do anything through through the API. I had done some simple actions in the UI. In this starter example thereās some linked elements and I went to remove the linked
askDorianin the subcategories.
Iāll try and spin a new project of the same up again and see if I can replicate it
Aug 5, 2021, 2:29 PM
E
Weāre also investigating on our end
Aug 5, 2021, 2:31 PM
C
Do you want me to grant you access to the project if that can help you in any way?
Aug 5, 2021, 2:32 PM
E
Thank you! Someone will be in touch on DM if that would be helpful.
Aug 5, 2021, 2:32 PM
P
Hi Casper, thanks for reporting this issue. We were able to reproduce it on our side as well now.
In its custom desk structure, the starter generates list item IDs from its subsection titles. This means that if the same title exists in a draft + published version of the same doc, or in two different documents, you'll end up with duplicate list item IDs.
Could it be that you might have edited or duplicated the subsection named "Ask Dorian" right before the error started happening?
We'll fix this in the starter itself, but to avoid having to start from scratch, you could make these changes to your
1. On line 22, replace this:
With this:
2.
After line 66:
Add this:
Please let me know if anything's unclear or the line numbers don't correspond for you
š
In its custom desk structure, the starter generates list item IDs from its subsection titles. This means that if the same title exists in a draft + published version of the same doc, or in two different documents, you'll end up with duplicate list item IDs.
Could it be that you might have edited or duplicated the subsection named "Ask Dorian" right before the error started happening?
We'll fix this in the starter itself, but to avoid having to start from scratch, you could make these changes to your
/src/deskStructure.jsfile:
1. On line 22, replace this:
'subsections': *[_type=='subsection'&& references(^._id) ]{name, _id, slug}
'subsections': *[_type=='subsection' && references(^._id) && !(_id in path("drafts.**"))]{name, _id, slug}
After line 66:
.title(sub.name)
.id(sub._id)
š
Aug 5, 2021, 3:15 PM
C
Thanks for the help, Peter! I can access the studio again.Now that I can see the studio I can better trace my steps; I believe I removed āAsk Dorianā from āBehind the scenes with Dorianā under Style > Ask Dorian. And then I also edited āAsk Dorianā under Subsection options. Iām not entirely sure what caused it to crash though.
Aug 5, 2021, 3:27 PM
C
Since Iām still new to Sanity and have only been playing around with this starter project for ~5 min. I canāt really say whether or not this is a common problem, but it seems rather easy to run into if several content creators are playing around in the studio? Or is it just because of this specific setup?
user A
mentioned that youāre not supposed to be able to break the UI, but am I supposed to set additional āsecurityā up so this doesnāt happen?Sanity seems great but it concerns me that the studio can become inaccessible like that.Aug 5, 2021, 3:34 PM
E
It was an issue with the configuration of the starter that made it prone to this. Weāve now fixed it so it wonāt happen to anyone else. I myself have never seen this exact error before.
Aug 5, 2021, 3:50 PM
C
Okay, that was also my understanding. Itās reassuring you havenāt encountered it before. I guess itās just unlucky that I bump into it during the first project I play around with.Thanks for the quick help!
Aug 5, 2021, 3:55 PM
E
No problem āĀ thanks for letting us know so we could fix it upstream! šāāļø
Aug 5, 2021, 6:12 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.