facebook / lexical

Lexical is an extensible text editor framework that provides excellent reliability, accessibility and performance.
https://lexical.dev
MIT License
17.37k stars 1.43k forks source link

Docs: Add FAQs about hot module reloading #5911

Open etrepum opened 2 weeks ago

etrepum commented 2 weeks ago

Since Lexical relies on object identity quite a lot, it can run into trouble when developing apps using a hot module reloader. We should have some docs that cover which error messages are likely to happen in these scenarios, and also the sorts of workarounds you can use to ensure that the Lexical editor is reloaded when its dependencies change identity.

These docs could possibly also cover the scenario when two different versions of Lexical (or a plugin) are loaded into the same app, since some of the error messages may be similar.

acywatson commented 2 weeks ago

One thing that has bitten me before with this is COMMAND identity. Sometimes, for some reason, the references used by the listeners and the ones defined in the core diverge. I think it has to do with HMR somehow, but not sure. it can be really confusing and hard to debug when it happens.