I have this small component as an example..
import { CollectionConfig } from 'payload/types'
import { SLUGS } from '../slugs'
export const AccordionItem: CollectionConfig = {
slug: SLUGS.collections.accordionItem,
admin: { useAsTitle: 'title' },
fields: [
{
name: 'title',
type: 'text',
required: true,
localized: true,
},
{
name: 'details',
type: 'richText',
},
],
}
As soon as I enable the richText field, the UI crashes giving the following error
Uncaught Error: [Slate] editor is invalid! You passed: {"children":[],"operations":[],"selection":null,"marks":null,"history":{"undos":[],"redos":[]}}
It is not about the database as I created a blank database and the problem remains same.
I'm using latest payload version to date
"payload": "^1.8.3",
Another thing I'd like to add is that I'm using slate separately in package.json as I'm using it to render the richText on my frontend.
"slate": "^0.94.1",
It has been working without a problem since a couple months but not anymore.
I've played with different node versions (current is v18.12.0).
I realized that it works if I re-install the packages with
yarn
.
Also, a fresh
payload
installation either with
npm
or
yarn
works as expected.
Now, I'm clear that this is not a problem with
payload
but something else.
I'm bound here to use
npm
as the docker image build size is one-third of what I get with
yarn
.
With this context, any guide or suggestion is appreciated.
try and make sure that your Slate version in your own code matches the one that Payload uses itself
right now, that is
"slate": "^0.91.4"
It worked.
Thanks @jmikrut 😍
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.