Several react apps at the same page with Lexical editors causing error unable to find an active editor state

232 views Asked by At

The problem occur when several react apps with lexical editors are used at the same page.

The first app that is getting focus works as expected no matter which app it is, but as soon as another app is getting focus an error occur that lexical is unable to find an active editor state. The first app editor is still working as excepted (sometimes).

Uncaught Error: Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update() or editorState.read().
    at getActiveEditorState (Lexical.dev.js:7379:1)
    at $getNodeByKey (Lexical.dev.js:721:1)
    at ParagraphNode.getLatest (Lexical.dev.js:4090:1)
    at ParagraphNode.getParent (Lexical.dev.js:3690:1)
    at ParagraphNode.getIndexWithinParent (Lexical.dev.js:3664:1)
    at internalResolveSelectionPoint (Lexical.dev.js:6682:1)
    at internalResolveSelectionPoints (Lexical.dev.js:6787:1)
    at internalCreateRangeSelection (Lexical.dev.js:6898:1)
    at internalCreateSelection (Lexical.dev.js:6851:1)
    at beginUpdate (Lexical.dev.js:8008:1)

Everything works fine with one app and several editor components. But something seems to get out of sync when several apps is used.

I have tried to set the namespace in Lexical to an unique application ID but it doesn't makes any sense.

0

There are 0 answers