-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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]: Issue with flushSync Error when Using addNodeView() in Next.js with Tiptap #4355
Comments
I am experiencing this same error in a Vite React app. It only appears when HMR refreshes (ie saving a file). This could be a duplicate issue though: #3580 |
This problem does indeed seem quite awkward, although it currently doesn't seem to have any effect on the actual results. |
The performance of ReactNodeView deteriorates significantly as the number of lines increases, whereas the Vue version of NodeView performs quite normally. |
In my situation, I was experiencing poor performance and lag as the number of lines in a if (this.initialized) {
flushSync(fn);
} else {
fn();
} to: if (this.initialized) {
fn();
} else {
fn();
} The lag and performance issues were resolved. I am just not sure what potential risks this change might introduce. |
I experience the same issue , hopefully this will be fixed soon |
i think tiptap editor try to sync with the dom update so for now here my temporary solution:
Instead of
|
This is the only config that works for us:
|
Fwiw, I had flushSync issues when adding nodeViewRenderes (react), turns out the issue spawned from conditionally rendering the EditorContent in my main Editor component (so the issue wasn't in any nodeView components) const [isSynched, setIsSynched] = useState(false) return (
{isSynched ? (
) : (
)}
...
)
Removing the conditionality solved it for me.
|
This should be fixed in Tiptap 2.9 |
Which packages did you experience the bug in?
nextjs
What Tiptap version are you using?
2.1.1
What’s the bug you are facing?
When using the addNodeView() method with a ReactNodeViewRenderer component in conjunction with the tiptap library within a Next.js project, an error is encountered during runtime. The error message indicates that flushSync was called from inside a lifecycle method, causing React to be unable to flush while rendering is already ongoing. This error disappears when the addNodeView() method is removed.
Steps to Reproduce:
Expected Behavior:
The editor should render without any errors or warnings related to flushSync.
Actual Behavior:
An error occurs with the following warning message:
Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.
Relevant Code:
What browser are you using?
Edge
Code example
No response
What did you expect to happen?
The editor should render without any errors or warnings related to flushSync.
Anything to add? (optional)
The issue seems to be related to the interaction between the addNodeView() method and React's rendering mechanism in a Next.js project.
Removing the addNodeView() code resolves the issue.
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: