-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(richtext-*): ensure admin panel doesn't freeze with some field co…
…nfigurations consisting of 2+ richtext fields (#8773) See comments in code for proper explanation. In some cases, where 2 richtext `editor`s referencing the same `editor` are used, the admin panel will hang. That's because the server will send their client props that have the same object reference down to the client twice. Next.js sometimes does not like this and, ever since one of the v15 canaries, started to hang
- Loading branch information
Showing
4 changed files
with
72 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
test/fields/collections/LexicalObjectReferenceBug/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { CollectionConfig } from 'payload' | ||
|
||
import { lexicalEditor, UploadFeature } from '@payloadcms/richtext-lexical' | ||
|
||
/** | ||
* Do not change this specific CollectionConfig. Simply having this config in payload used to cause the admin panel to hang. | ||
* Thus, simply having this config in the test suite is enough to test the bug fix and prevent regressions. In case of regression, | ||
* the entire admin panel will hang again and all tests will fail. | ||
*/ | ||
export const LexicalObjectReferenceBugCollection: CollectionConfig = { | ||
slug: 'lexicalObjectReferenceBug', | ||
fields: [ | ||
{ | ||
name: 'lexicalDefault', | ||
type: 'richText', | ||
}, | ||
{ | ||
name: 'lexicalEditor', | ||
type: 'richText', | ||
editor: lexicalEditor({ | ||
features: [ | ||
UploadFeature({ | ||
collections: { | ||
media: { | ||
fields: [ | ||
{ | ||
name: 'caption', | ||
type: 'richText', | ||
}, | ||
], | ||
}, | ||
}, | ||
}), | ||
], | ||
}), | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters