Skip to content

Block add causes JSON undefined error in lexical editor #14022

@loki-dog

Description

@loki-dog

Describe the Bug

Adding any block that contains the lexical rich text editor throws an undefined is not valid JSON.
Occurs when adding CTA block or content block to a layout on pages or in products on ecommerce template

payload.json.bug.mp4

Occurs in file payload/packages/richtext-lexical/src/field/Field.tsx line 150, recently fixed in #13813

Link to the code that reproduces this issue

https://github.com/loki-dog/payload-json-bug

Reproduction Steps

  1. Clone repo
  2. pnpm i
  3. pnpm dev
  4. Login
  5. Navigate to pages > home
  6. Add layout
  7. Add column, after a few seconds the undefined error appears
  8. Optionally add a layout > add CTA block, error appears after a few seconds

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 23.7.0
  npm: 11.4.0
  Yarn: N/A
  pnpm: 10.12.4
Relevant Packages:
  payload: 3.58.0
  next: 15.5.4
  @payloadcms/db-postgres: 3.58.0
  @payloadcms/email-nodemailer: 3.58.0
  @payloadcms/graphql: 3.58.0
  @payloadcms/live-preview: 3.58.0
  @payloadcms/live-preview-react: 3.58.0
  @payloadcms/next/utilities: 3.58.0
  @payloadcms/plugin-form-builder: 3.58.0
  @payloadcms/plugin-seo: 3.58.0
  @payloadcms/richtext-lexical: 3.58.0
  @payloadcms/translations: 3.58.0
  @payloadcms/ui/shared: 3.58.0
  react: 19.1.1
  react-dom: 19.1.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions