Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Trying to implement a custom SlateJS element following the custom-website-series.

default discord avatar
vaunblu2 years ago
3

I have everything set up the same, but I keep getting this error on the front-end. What is set up differently in the custom-website series that allows one to use useSlate in their elements/leaves?



It is also used in the link element in the current build of payload

  • discord user avatar
    jmikrut
    2 years ago

    you should be able to

    useSlate

    for sure



    do you have a local copy of Slate installed?



    it must be on the same version otherwise your

    useSlate

    hook could be using a different copy of context vs. the internal one that Payload uses. You also might try and add a webpack alias to enforce that Webpack always uses the same copy of Slate, which would alleviate this even if you did have multiple copies installed

  • default discord avatar
    vaunblu2 years ago

    Ok I will double check those and get back to you on that! Thanks for the tip

  • default discord avatar
    reepicheep052 years ago

    hey

    @1028003433090924695

    , wanted to ask what your solution was to this as I am getting the same error.



    I am starting a project and using the PayloadCMS website repo as a starting point. The

    useSlate

    hook is called in the richText field in the video Button component and I am getting this error whenever the Rich Text Editor is rendered in the admin.



    Edit: I believe this was caused by a

    slate

    version mismatch as pointed out by

    @364124941832159242

    . I was able to resolve by uninstalling

    slate

    and

    slate-react

    . Thanks for the help!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.