Describe the bug
When I want to edit a rich text input inside a array of input components, the studio crashes. It didn't crash before.
The weird thing is that I did not make any changes to my schema. All I did was to update the studio. I can't tell exactly after which update the bug occurs.
To Reproduce
https://sanity-io-land.slack.com/files/UEV4PL734/FMBSN4YSV/studio_crash.webm
Which versions of Sanity are you using?
Run sanity versions in the terminal and copy-paste the result here.
@sanity/cli 0.141.5 (latest: 0.142.0)
@sanity/base 0.142.1 (up to date)
@sanity/components 0.142.1 (up to date)
@sanity/core 0.142.1 (up to date)
@sanity/dashboard 0.142.1 (up to date)
@sanity/default-layout 0.142.1 (up to date)
@sanity/default-login 0.142.1 (up to date)
@sanity/desk-tool 0.142.1 (up to date)
@sanity/production-preview 0.142.0 (up to date)
@sanity/vision 0.142.1 (up to date)
Which versions of Node.js / npm are you running?
Node 10.16.0
Yarn 1.17.3
Downgrading to 0.141.6 fixed the problem :confused:
The issue appears to be the block array being first element in the fields array of a document or object.
Thanks for taking the time to report this bug @mornir 馃憤
Just a quick update on this: We're working on this today. Release time depends on the scope of the problem, but it's under way!
This was fixed yesterday in the release of v0.142.2.
This is still a bug if the rich text editor is in a collapsible fieldset that is collapsed by default.
@abstracthat I'm not able to reproduce that. Do you have a excerpt of a schema where this happens?
FWIW - we've got an upcoming fix that will make this a warning instead of a hard error (#1467).
Sure. The following is excerpted from blog-post.js schema. If I set the first fieldset that contains the rich text editor to collapsed: false then it works ok.
export default {
name: 'blogPost',
type: 'document',
title: 'Blog post',
fieldsets: [
{ name: 'content', title: 'Post content', options: { collapsible: true } },
{ name: 'featuredImage', title: 'Featured image', options: { collapsible: true } },
{ name: 'preview', title: 'Preview card', options: { collapsible: true } },
{ name: 'info', title: 'Post information', options: { collapsible: true } },
{ name: 'meta', title: 'Metadata', options: { collapsible: true } }
],
fields: [
{
name: 'title',
type: 'string',
title: 'Title',
fieldset: 'content',
validation: Rule => Rule.required()
},
{
name: 'subTitle',
type: 'text',
title: 'Sub-title',
fieldset: 'content',
rows: 3,
validation: Rule => Rule.max(300)
},
{
name: 'body',
type: 'editor',
title: 'Post body',
fieldset: 'content'
},
...
and editor鈥檚 schema is
export default {
name: 'editor',
title: 'Text editor',
type: 'array',
validation: Rule => Rule.required(),
of: [
{ type: 'numberedSubHeading' },
{ type: 'editorImage' },
{ type: 'video' },
{ type: 'tip' },
{ type: 'pullQuote' },
{ type: 'featuredQuote' },
{
type: 'block',
styles: [
{ title: 'Normal', value: 'normal' },
{ title: 'Heading', value: 'h2' },
{ title: 'Sub-heading', value: 'h3' },
{ title: 'Nested sub-heading', value: 'h4' },
{ title: 'Simple quote', value: 'blockquote' }
],
marks: {
decorators: [{ title: 'Strong', value: 'strong' }, { title: 'Emphasis', value: 'em' }],
annotations: [
{
name: 'internalLink',
type: 'internalLink',
title: 'Internal link'
},
{
name: 'link',
type: 'externalLink',
title: 'External link'
}
]
}
}
]
}
Also I should mention it doesn't crash the whole CMS, just the input component for the editor.
Most helpful comment
Downgrading to 0.141.6 fixed the problem :confused: