-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Describe the Bug
Related to: #13192
When editing a document of a collection with any other field and a lexical rich text field with blocks that have upload and/or relationship fields, saving the document fails to validation errors if any other field other than the lexical field has been edited and auto save is enabled. When creating a new document, this happens only after reloading the page after creating the document.
Additionally, the status of the document is Changed
immediately after creating the document and the Publish changes
button remains enabled even after clicking it multiple times. This resolves after reloading the page.
The validation errors in question are: block node failed to validate: The following fields are invalid: relationship
for the RelationshipBlock and block node failed to validate: The following fields are invalid: upload
for the UploadBlock in the reproduction.
Just a guess but this might be caused by changes introduced in: #13438
Link to the code that reproduces this issue
https://github.com/ApsiV11/payload-lexical-bug
Reproduction Steps
- Clone the repository
- Install dependencies with
pnpm install
and start the project withpnpm dev
and go to the admin panel - Create a new
Collection
document, add anUpload Block
with a reference to Media to theRich Text Field
and save the document. - Reload the page, check the
Other field
, wait for auto save and try publish the changes. Saving fails to validation errors. - Repeat steps 3 and 4 now using the
Relationship Block
. Also fails.
- Additionally also try removing the auto saving from the
Collection
-collection in the codesrc/collections/Collection.ts
- After pushing the schema to the database and repeating steps 3 and 4, the validation errors don't happen anymore
Which area(s) are affected? (Select all that apply)
plugin: richtext-lexical, area: ui
Environment Info
Binaries:
Node: 24.2.0
npm: N/A
Yarn: N/A
pnpm: 10.10.0
Relevant Packages:
payload: 3.54.0
next: 15.4.4
@payloadcms/db-postgres: 3.54.0
@payloadcms/email-nodemailer: 3.54.0
@payloadcms/graphql: 3.54.0
@payloadcms/next/utilities: 3.54.0
@payloadcms/payload-cloud: 3.54.0
@payloadcms/richtext-lexical: 3.54.0
@payloadcms/translations: 3.54.0
@payloadcms/ui/shared: 3.54.0
react: 19.1.0
react-dom: 19.1.1
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 16076
Available CPU cores: 8