[BUG] React 18 `Suspense` breaks decorator nodes like tables
- [x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- [x] I have read the documentation and cannot find an answer.
Describe the bug
If you wrap the editor into a Suspense component and then something suspends - then after editor gets rendered again all decorator nodes like tables/images wouldn't be shown.
⚠ Happens in React 18 only, version 19 is fine.
Reproduction Start from https://codesandbox.io/p/sandbox/mdx-editor-base-q8s7zr?file=/src/App.tsx to reproduce the problem so that I can observe the issue on my side and make sure that the fix reliably addresses it.
To Reproduce Steps to reproduce the behavior:
- Go to https://codesandbox.io/p/devbox/mdx-editor-base-forked-zwcrn2 (React 18)
- Click the "Simulate" button
- Verify the table is not shown after re-render
- Go to https://codesandbox.io/p/devbox/mdx-editor-base-forked-2ww4lx?workspaceId=ws_3LCuG5GZhcebWgEP9i6HT5 (React 19)
- Click the "Simulate" button
- Verify the table is shown
Expected behavior Decorators are always shown.
Additional context I'm not entirely sure about the scope of this bug - seems to be caused by the Lexical update happened in 3.11.0 release
@FarSeeing I'm not entirely sure about this, but there's some chance this to be a Lexical bug. It would help me a lot if you try to reproduce the problem with a pure lexical editor, maybe there are similar reports in their issues/discord.
Hey @petyosi I've tried doing the same thing on Lexical playgorund and turns out it works fine with React 18:
https://github.com/user-attachments/assets/c8aecbd1-4314-4302-83d6-784540918051