#Uploading Rich Text with Blocks to Payload CMS

2 messages · Page 1 of 1 (latest)

nocturne glacier
#

Hi! I am using a script to upload a set of posts to a collection in Payload CMS. The posts are being translated into a "blocks" type format, and one of the fields on the blocks is a richText field (w/ lexical editor), inside of which i am using the BlocksFeature to embed a special heading. the JSON i am uploading to the "blocks" field looks like this:

[{ "blockType": "ColumnBlock", "column1": { "backgroundColor": "", "content": { "root": { "children": [ { "type": "block", "format": "", "version": 1, "fields": { "blockType": "HeaderBlock", "headingColor": "#236489", "text": "Who can join?", "blockName": "" } .......... etc

I can use payload.create to upload this successfully, and it renders correctly on the page. However, in the payload CMS admin panel, i am seeing this error when viewing the document:

Cannot read properties of undefined (reading 'blockReferences')

I have tried inspecting the "Blocks" client component in the @payloadcms/richtext-lexical package, but i cant the root cause of the issue. wondering if anyone else has encountered this before?