Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Issue with Desk tool crashing when deleting the last document in an array-type field.

8 replies
Last updated: Feb 8, 2022
Hi there! I have a question about a weird behaviour I'm experiencing in the Desk tool.
Description: the Desk tool crashes when I empty the array-type field by deleting the
last
existing document.

{
              name: 'domain',
              type: 'array',
              title: 'Domain',
              of: [{ type: 'restricted_domain' }],
              hidden: .....,
              validation: (Rule) =>
                domainRestrictionsValidator(.....),
}
Basically when I delete the last
restricted_domain
Desk tool crashes with the error
TypeError: Cannot read properties of undefined (reading 'length')
I think that something similar was raised 
here . Any idea how I can stop that behaviour?
Feb 3, 2022, 4:46 PM
Hi Debora. Thank your for reporting, and sorry you've ran into this! Please can you let me know which version of Sanity Studio you're using? If you could paste the output of the
sanity versions
command, that would be perfect.
Feb 3, 2022, 4:53 PM
Sure! thanks for the quick response
@sanity/cli             2.11.0 (latest: 2.26.0)
@sanity/base            2.25.0 (latest: 2.26.0)
@sanity/cli             2.25.0 (latest: 2.26.0)
@sanity/color-input     2.25.0 (latest: 2.26.0)
@sanity/components      2.14.0 (up to date)
@sanity/core            2.25.0 (latest: 2.26.0)
@sanity/default-layout  2.25.0 (latest: 2.26.0)
@sanity/default-login   2.24.1 (latest: 2.26.0)
@sanity/desk-tool       2.25.0 (latest: 2.26.0)
@sanity/types           2.24.0 (latest: 2.26.0)
@sanity/vision          2.25.0 (latest: 2.26.0)

Feb 3, 2022, 4:59 PM
(it also fails without the custom validation Rule I created and the hidden property)
Feb 3, 2022, 5:02 PM
Would it be possible for you to update to the latest version (by running
sanity upgrade
), just to eliminate that as a potential issue?
Feb 3, 2022, 5:05 PM
it's messing up things a bit, I'll get back to you on Monday. Thank you for now 🙂
Feb 3, 2022, 5:16 PM
user E
FYI upgrading sanity fixed the issue
Feb 8, 2022, 1:18 PM
user E
FYI upgrading sanity fixed the issue
Feb 8, 2022, 1:18 PM
Awesome! I'm so glad to hear that 🙂. Please let us know if we can help with anything else.
Feb 8, 2022, 1:57 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?