Like what we’re doing? Star us on GitHub!

Replacing useMemo with useState?

2 months ago

Currently, when I try to set a custom elements or leaves in the richText, I get

Cannot find a descendant at path

error which causes because useMemo is reevaluated on reloads so we might need to use useState instead?

Related issue:

@Jarrod any thoughts?

  • jmikrut
    Payload Team
    last month

    This is probably due to your implementation, and you might be attempting to use an improper path or location

    that error is common when you try to update a node's properties (or similar) but the path that you're trying to do that against is not valid

    we do this often within Slate, all over the place in fact - so it's not something that is related to our use of



  • Mng
    4 weeks ago

    @jmikrut hmm, all i wanted to do is overriding the elements in the richText so thats what i did

    <RichText name="test" label="Test" admin={{elements:['h1', 'h2']}}/>

    then i got the error i mentioned but worked fine after i replaced useMemo with useState

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More