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
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
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',
|
|
},
|
|
],
|
|
},
|
|
},
|
|
}),
|
|
],
|
|
}),
|
|
},
|
|
],
|
|
}
|