Unlock seamless workflows and faster delivery with our latest releases – get the details

Error with schema when used inside blockContent in Sanity Studio

15 replies
Last updated: Sep 26, 2021
Hello, this schema when used inside blockContent, gives me error

export default {
  name: "slideshow",
  title: "Slideshow",
  type: "array",
  of: [
    {
      type: "image",
      fields: [
        {
          name: "caption",
          type: "string",
          title: "Caption",
          options: {
            isHighlighted: true, // <-- make this field easily accessible
          },
        },
      ],
    },
  ],
};
The error i get is,


ypeError: (value || []).some is not a function
    at ArrayInput.render (/static/js/app.bundle.js:237432:44)
    at finishClassComponent (/static/js/vendor.bundle.js:20302:31)
    at updateClassComponent (/static/js/vendor.bundle.js:20252:24)
    at beginWork (/static/js/vendor.bundle.js:21762:16)
    at HTMLUnknownElement.callCallback (/static/js/vendor.bundle.js:3330:14)
    at Object.invokeGuardedCallbackDev (/static/js/vendor.bundle.js:3379:16)
    at invokeGuardedCallback (/static/js/vendor.bundle.js:3434:31)
    at beginWork$1 (/static/js/vendor.bundle.js:26345:7)
    at performUnitOfWork (/static/js/vendor.bundle.js:25296:12)
    at workLoopSync (/static/js/vendor.bundle.js:25272:22)

Sep 26, 2021, 4:23 PM
Is this an error within the studio?
Sep 26, 2021, 4:29 PM
Yes it is within the studio
Sep 26, 2021, 4:30 PM
nothing seems wrong in the schema. Do you have any plugins that work with this field? or any document level validations?
Sep 26, 2021, 4:31 PM
No document level validations, also no plugins here
Sep 26, 2021, 4:35 PM
I assume it doesn’t give you any errors if used outside of blockContent?
Sep 26, 2021, 4:36 PM
yes it doesnt' give any errors when used inside other schemas
Sep 26, 2021, 4:37 PM
Not sure, hopefully someone else can guess the reason. Just in case what studio version are you using?
Sep 26, 2021, 4:38 PM
latest one
Sep 26, 2021, 4:39 PM
Assuming
blockContent
is an array, then you’ll need to nest
slideshow
in an object to avoid the first limitation here .
Sep 26, 2021, 4:55 PM
Thank you
user A
and
user U
Sep 26, 2021, 4:56 PM
Assuming
blockContent
is an array, then you’ll need to nest
slideshow
in an object to avoid the first limitation here .
Sep 26, 2021, 4:55 PM
Hello
user A
, I'm a bit confused. How can I nest an array of images though?
Sep 26, 2021, 5:09 PM
user G
instead of making it the
array
type make an object type and put this slideshow as an array type into a field on this object type
Sep 26, 2021, 5:51 PM
user G
instead of making it the
array
type make an object type and put this slideshow as an array type into a field on this object type
Sep 26, 2021, 5:51 PM
Thanks
Sep 26, 2021, 5:51 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?