-
-
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
fix: Queue flushSync call #3533
Conversation
Do the same thing as ueberdosis#3188
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Looks good. Can you merge ASAP? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using queueMicrotask
removes the warning but introduces this issue #3331 again. If we queue the update, changes are not immediately flushed to the DOM.
I think we instead need to reset the initialized
flag properly when the editor unmounts. For us, the warning only occurred in those situations. Adding this.initialized = false
before we reset the node views, worked for us:
componentWillUnmount() {
const { editor } = this.props
if (!editor) {
return
}
this.initialized = false
if (!editor.isDestroyed) {
editor.view.setProps({
nodeViews: {},
})
}
editor.contentComponent = null
if (!editor.options.element.firstChild) {
return
}
const newElement = document.createElement('div')
newElement.append(...editor.options.element.childNodes)
editor.setOptions({
element: newElement,
})
}
What's the status for this PR? I need this fix ASAP. |
@konstantinmuenster is right. Reintroducing #3331 would be a mistake. I will try @konstantinmuenster 's fix in our fork and report back. |
Also experiencing this bug since we updated to +1 on fixing this ASAP 🙏 |
any news on this?? |
+1 |
ANy news on this one? It's pretty annoying with Suspense |
🤔 |
+1, my project is failing build with this issue. 😅 |
Rolling back to |
upgraded to |
@jamesopti, how did that fix go? Would be great to get this sorted. |
Sorry for the delay in testing this. I just got a chance to test this PR and unfortunately, the issue NodeView cursor issue remains. Here is a codesandbox showing the issue with the latest code from https://codesandbox.io/s/react-nodeview-flushsync-debug-mji07b?file=/src/App.tsx |
Here's a codesandbox using @konstantinmuenster 's fix and it appears to work as expected: https://codesandbox.io/s/react-nodeview-flushsync-debug-alternate-thmr3m?file=/src/App.tsx I'll test this in our app and report back. |
Hey. I have the fix proposed by @konstantinmuenster open as a PR already and will release it on monday morning. Looking forward to hear your feedback! |
* Add custom paragraph example * Remove unnecessary queueMicrotask
2.0.1 triggered via either of the commands: addCommands() {
return {
setInlineImageFloat: (floatTo) => ({ commands }) => {
return commands.updateAttributes('inline-image', {'data-float': floatTo});
},
setInlineImageSize: (sizeTo) => ({ commands }) => {
return commands.updateAttributes('inline-image', {'data-size': sizeTo});
}
};
},
|
Do the same thing as ueberdosis#3188
…berdosis#3533 (ueberdosis#3862) * Add custom paragraph example * Remove unnecessary queueMicrotask
Do the same thing as ueberdosis#3188
…berdosis#3533 (ueberdosis#3862) * Add custom paragraph example * Remove unnecessary queueMicrotask
Do the same thing as #3188 - confirmed this got rid of the warning locally