-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
status: cant-reproduceIf an issue cannot be reproducedIf an issue cannot be reproduced
Description
Describe the Bug
Polymorphic uploads within a block used in a Lexical editor cause the editor to crash.
For instance, a simple block like this:
export const TestBlock: Block = {
slug: "test-block",
fields: [
{
type: "text",
name: "title",
},
{
type: "upload",
name: "image",
relationTo: [ "assets", "media" ],
required: true,
}
],
};Embedded within a Lexical editor like this:
fields: [
{
name: "content",
type: "richText",
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
BlocksFeature({
blocks: [
TestBlock,
],
})
],
}),
},
],Initially, it worked as expected, allowing me to create a new document with these blocks and select images. However, attempting to change the upload within the block after saving the document crashes the entire editor to an unrecoverable state.
Video_2025-11-09_024253.mp4
Link to the code that reproduces this issue
https://github.com/immotus/bug-polymorphic-uploads/
Reproduction Steps
- Clone the repo
pnpm ipnpm dev- Go to
localhost:3000 - Seed the test database
- Upload some images into the
Assetscollection - Go to the
Testcollection and create a new document - Add a couple of
TestBlockslinking to images in Assets and Media collections - Save the document
- Go to the
Testcollection and open the newly created document again - Try to change images within the blocks to another image from a different collection
Which area(s) are affected? (Select all that apply)
plugin: richtext-lexical, area: core
Environment Info
Binaries:
Node: 24.8.0
npm: N/A
Yarn: N/A
pnpm: 10.17.0
Relevant Packages:
payload: 3.63.0
next: 15.4.7
@payloadcms/db-mongodb: 3.63.0
@payloadcms/graphql: 3.63.0
@payloadcms/live-preview: 3.63.0
@payloadcms/live-preview-react: 3.63.0
@payloadcms/next/utilities: 3.63.0
@payloadcms/plugin-form-builder: 3.63.0
@payloadcms/plugin-nested-docs: 3.63.0
@payloadcms/plugin-redirects: 3.63.0
@payloadcms/plugin-search: 3.63.0
@payloadcms/plugin-seo: 3.63.0
@payloadcms/richtext-lexical: 3.63.0
@payloadcms/translations: 3.63.0
@payloadcms/ui/shared: 3.63.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32631
Available CPU cores: 16
Metadata
Metadata
Assignees
Labels
status: cant-reproduceIf an issue cannot be reproducedIf an issue cannot be reproduced