Problem
Opening @@edit for a File content object (e.g. uploaded through Aurora) crashes with the error boundary:
TypeError: Cannot read properties of undefined (reading '__somersault__')
at get$1 (…/dist-….js:178:62)
at getValueUsingOptic (…/dist-….js:413:19)
at Object.read (…/dist-….js:402:86)
at atomRead (…/vanilla-….js:57:50)
Steps to reproduce
- Upload a file (e.g. via
@@contents upload).
- Open
@@edit on the uploaded File.
- The route crashes with the error above.
Analysis so far
- The stack points at
jotai-optics: packages/cmsui/routes/atoms.ts focuses the form atom with optic.prop('blocks').prop(id).
- A
File has no blocks field (the type does not use the blocks behavior), so the optic reads undefined, and the subsequent access to the Somersault block key (SOMERSAULT_KEY = '__somersault__', packages/plate/constants.ts) throws.
- In other words: the edit route currently assumes blocks-enabled content. Any type without the blocks behavior is likely affected (e.g.
Image as well).
- Prior art: Volto renders a plain schema-driven form for such types and only mounts the blocks editor when the content has the blocks behavior.
Expected behavior
@@edit works for content types without the blocks behavior, rendering the schema fields without the Somersault editor (or with a guarded, empty editor state).
References
packages/cmsui/routes/atoms.ts (blocks optic)
packages/plate/constants.ts (SOMERSAULT_KEY)
Problem
Opening
@@editfor aFilecontent object (e.g. uploaded through Aurora) crashes with the error boundary:Steps to reproduce
@@contentsupload).@@editon the uploaded File.Analysis so far
jotai-optics:packages/cmsui/routes/atoms.tsfocuses the form atom withoptic.prop('blocks').prop(id).Filehas noblocksfield (the type does not use the blocks behavior), so the optic readsundefined, and the subsequent access to the Somersault block key (SOMERSAULT_KEY = '__somersault__',packages/plate/constants.ts) throws.Imageas well).Expected behavior
@@editworks for content types without the blocks behavior, rendering the schema fields without the Somersault editor (or with a guarded, empty editor state).References
packages/cmsui/routes/atoms.ts(blocks optic)packages/plate/constants.ts(SOMERSAULT_KEY)