[lexical] Chore: make unable to find active editor state error more descriptive about potential dependency issue
This error message can be kinda similar to the React hooks error message:
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
E.g. If people have multiple versions of lexical installed, where the lexical editor is initialized by one version of lexical, but their own custom nodes are initialized by a different version, this error message will occur.
This happens to SO many people after they upgrade my package and forget to make sure their lexical version matches the one which my package is using.
Adding this hint to the error message will give them a chance to figure out why this might be happening
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| lexical | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 1, 2024 4:33pm |
| lexical-playground | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 1, 2024 4:33pm |
If it happens often to the users of your library - may I ask if you place Lexical as dependency or peerDependency in package.json? It shall be the latter with range of versions supported