Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Undefined in Array of Blocks and Unable to Load Edit View for Document #10485

Open
58bits opened this issue Jan 10, 2025 · 1 comment
Open
Labels
created-by: Contributor status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@58bits
Copy link
Contributor

58bits commented Jan 10, 2025

Describe the Bug

A user working on a document that contained an array of blocks lost access to the document as a block became undefined (possibly while reordering blocks).

The problem was recently posted to Discord - https://discord.com/channels/967097582721572934/1102950643259424828/1326859801761939477 . Another user there (@JannikZed) also described having the same issue.

Attached is an image that shows the state of the field in the document - Object for block 6 (array index position 7) is now undefined.

Image

We then receive the following server error:

ERROR: Block with type "undefined" was found in block data, but no block with that type is defined in the config for field with schema path pages.content.

The user is then unable to edit the document - receiving a blank document edit screen - as shown below...

Image

Link to the code that reproduces this issue

https://github.com/payloadcms/payload

Reproduction Steps

Apologies for the link above - we've not immediately been able to reproduce this however it results in the loss of data, and was confirmed as an issue independently by a second user in Discord (@JannikZed) and so I felt this was serious enough to warrant the issue here.

Even if the issue can't be immediately resolved, I was wondering if it might be possible to more defensively code for block rendering, so that only the missing / undefined block show's as an error. The user would still be able to access the rest of the document - optionally removing the undefined block so that they can continue working on the document (despite the loss of data in the undefined block).

Hope this helps.

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

area: core

Environment Info

Payload: v3.15.0
Node.js: v22.13.0 (LTS)
@58bits
Copy link
Contributor Author

58bits commented Jan 12, 2025

Another user in Discord - @fryght_ - has also experienced this. That makes three of us so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
created-by: Contributor status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant