Blank popup when editing custom annotation in Sanity Studio
10 replies
Last updated: Aug 26, 2022
H
When editing a custom annotation for portable text on Sanity Studio, the popup for editing annotation content is sometimes blank. Does anyone have any idea why this might be happening?
These are versions of Sanity packages I’m using on my project.
These are versions of Sanity packages I’m using on my project.
"@sanity/base": "^2.31.0", "@sanity/core": "^2.31.0", "@sanity/default-layout": "^2.31.0", "@sanity/default-login": "^2.31.0", "@sanity/desk-tool": "^2.31.0", "@sanity/eslint-config-studio": "^2.0.0", "@sanity/vision": "^2.31.0",
Aug 26, 2022, 5:14 PM
R
Hey
user F
! What does the schema for this annotation look like?Aug 26, 2022, 5:23 PM
(I believe this may be an issue with a regression in our UI library, which was recently fixed - removing any lockfile and reinstalling dependencies should fix it)
Aug 26, 2022, 6:12 PM
H
I removed
package-lock.jsonand ran
npm i. The same problem is still observed.
Aug 26, 2022, 6:58 PM
H
The schema for the field is the following:
{ name: 'expSent', title: 'Example Sentence', type: 'array', of: [ { type: 'block', styles: [], lists: [], marks: { decorators: [], annotations: [ { name: 'targetWord', title: 'Target Word', type: 'object', blockEditor: { icon: () => 'H', }, fields: [ { name: 'conjugation', title: 'Conjugation', type: 'string', initialValue: 'base', options: { list: conjugations, }, }, ], }, ], }, }, ], validation: Rule => Rule.custom(contents => { /** * Check for undefined * @see {@link <https://www.sanity.io/docs/validation#091e10f957aa>} */ if (typeof contents === 'undefined') return 'Example sentence required'; // Check the example sentence has only a single line if (contents.length !== 1) return 'Example sentence should be in a single line'; const content = contents[0]; // Check the length const numOfWords = content.children.reduce( (sum, span) => sum + span.text.length, 0 ); if (numOfWords > MAX_EXP_SENT_CHAR) return `Example sentence should be less-than-${MAX_EXP_SENT_CHAR}-character long. Current character length is ${numOfWords} characters`; // Check that one target word (phrase) is selected const numOfMarks = content.children.reduce( (sum, span) => (span.marks.length === 0 ? sum : sum + 1), 0 ); if (numOfMarks === 0) return 'Please select a target word in the example sentence'; if (numOfMarks > 1) return 'Only one consecutive-portion can be selected as target word'; return true; }), },
Aug 26, 2022, 6:59 PM
H
there is no error logged out on console on my browser
Aug 26, 2022, 7:01 PM
H
├─┬ @sanity/base@2.31.0 │ └── @sanity/ui@0.37.19 ├─┬ @sanity/default-layout@2.31.0 │ └── @sanity/ui@0.37.19 deduped ├─┬ @sanity/default-login@2.31.0 │ └── @sanity/ui@0.37.19 deduped ├─┬ @sanity/desk-tool@2.31.0 │ ├─┬ @sanity/field@2.31.0 │ │ └── @sanity/ui@0.37.19 deduped │ ├─┬ @sanity/form-builder@2.31.0 │ │ └── @sanity/ui@0.37.19 deduped │ └── @sanity/ui@0.37.19 deduped └─┬ @sanity/vision@2.31.0 └── @sanity/ui@0.37.19 deduped
Aug 26, 2022, 7:08 PM
Right, ideally it would use 0.37.21. Could you try removing both
package-lock.jsonand
node_modulesand then reinstalling dependencies with
npm install?
Aug 26, 2022, 7:11 PM
H
I forgot to delete
node_modulesbefore reinstalling. Now the sanity studio is working without any problem. Thank you so much for your help!
Aug 26, 2022, 7:27 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.