Error with schema when used inside blockContent in Sanity Studio
15 replies
Last updated: Sep 26, 2021
S
Hello, this schema when used inside blockContent, gives me error
The error i get is,
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 }, }, ], }, ], };
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
A
Is this an error within the studio?
Sep 26, 2021, 4:29 PM
S
Yes it is within the studio
Sep 26, 2021, 4:30 PM
A
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
S
No document level validations, also no plugins here
Sep 26, 2021, 4:35 PM
A
I assume it doesn’t give you any errors if used outside of blockContent?
Sep 26, 2021, 4:36 PM
S
yes it doesnt' give any errors when used inside other schemas
Sep 26, 2021, 4:37 PM
A
Not sure, hopefully someone else can guess the reason. Just in case what studio version are you using?
Sep 26, 2021, 4:38 PM
S
latest one
Sep 26, 2021, 4:39 PM
Assuming
blockContentis an array, then you’ll need to nest
slideshowin an object to avoid the first limitation here .
Sep 26, 2021, 4:55 PM
S
Thank you
user A
and user U
Sep 26, 2021, 4:56 PM
Assuming
blockContentis an array, then you’ll need to nest
slideshowin an object to avoid the first limitation here .
Sep 26, 2021, 4:55 PM
S
Hello
user A
, I'm a bit confused. How can I nest an array of images though?Sep 26, 2021, 5:09 PM
A
user G
instead of making it the arraytype 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
A
user G
instead of making it the arraytype 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
S
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.