mdx-editor / mdx-editor/editor
[BUG] React 18 `Suspense` breaks decorator nodes like tables
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 307
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 5
Description
- I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked React 18 CodeSandbox and click “Simulate” to reproduce the missing table after suspension; compare it with the React 19 sandbox where the table remains visible. Then inspect the Lexical update linked from the issue, especially the 3.11.0 change, and verify that decorator nodes such as tables and images remain visible after the editor re-renders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100