-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: 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(). #6481
Comments
This is a build issue on your end, you need to make sure they are both using the same exact lexical module. If you have two copies of lexical in separate chunks of your app, then they will not be compatible, you need to make sure only one lexical exists in your app. |
@etrepum If two micro frontend applications use different versions, lets say ( |
Currently no, it is only supported and tested to have at most one version of lexical on the page. Fixing it probably wouldn't be that much work, but testing it would be pretty tricky. |
Is it on the roadmap to support more than one version? |
If someone contributes an example project that can be used to test it, then it can be supported |
Also note, that due to the nature of this issue (a global event handler that tries to manage events for all lexical editors on the page), when this is fixed, older versions of lexical (without the fix) will still have this bug and will never work with any other lexical version. For example, assuming this is fixed by 0.18.0: 0.16.1 will never be able to coexist with 0.18.0, but 0.18.0 could coexist with 0.19.0. |
You can workaround this by using |
That workaround would only work if there is only one build of lexical included on the page. If the micro-frontends do not have a common chunk for lexical then the same problem will occur. The root cause isn't so much that the versions are different, but the identities of the modules and classes are different, which can occur if the same version of lexical is built multiple times and included in the same page. |
Lexical version: 0.16.1
Browser: Chrome latest version
Device: mac
Problem
I'm using the Lexical editor in two separate micro frontend applications. When I attempt to load both applications into the parent frontend, one RTE functions normally, and another one throw errors.
Steps To Reproduce
It is difficult to produce micro frontend environment in the codesandbox that we're working on, please let me know if any easier way to create micro frontend sandbox.
The current behavior
When I attempt to load both applications into the parent frontend, one RTE functions normally, while the other produces the following errors when attempting to access it:
All applications are using
esbuild
.The expected behavior
It should work seamlessly in all the micro frontend application.
Steps taken to resolve it
The text was updated successfully, but these errors were encountered: