-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: race condition in ReactRenderer #7362
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: race condition in ReactRenderer #7362
Conversation
🦋 Changeset detectedLatest commit: 19fbdb0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 71 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Pull request overview
This PR fixes a race condition in ReactRenderer where a component could be rendered after its destroy() method was called. The fix introduces a destroyed flag that prevents the queued microtask render from executing when the renderer has been destroyed.
Key changes:
- Added a
destroyedboolean flag to track destruction state - Added a check for the
destroyedflag in the queueMicrotask callback to prevent rendering after destruction - Set
destroyed = truein thedestroy()method
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@tiptap/extension-character-count
@tiptap/extension-dropcursor
@tiptap/extension-focus
@tiptap/extension-gapcursor
@tiptap/extension-history
@tiptap/extension-list-item
@tiptap/extension-list-keymap
@tiptap/extension-placeholder
@tiptap/extension-table-cell
@tiptap/extension-table-header
@tiptap/extension-table-row
@tiptap/extension-task-item
@tiptap/extension-task-list
@tiptap/core
@tiptap/extension-blockquote
@tiptap/extension-bold
@tiptap/extension-bubble-menu
@tiptap/extension-code
@tiptap/extension-bullet-list
@tiptap/extension-code-block
@tiptap/extension-code-block-lowlight
@tiptap/extension-collaboration
@tiptap/extension-collaboration-caret
@tiptap/extension-color
@tiptap/extension-details
@tiptap/extension-document
@tiptap/extension-drag-handle
@tiptap/extension-drag-handle-react
@tiptap/extension-drag-handle-vue-2
@tiptap/extension-drag-handle-vue-3
@tiptap/extension-emoji
@tiptap/extension-floating-menu
@tiptap/extension-file-handler
@tiptap/extension-font-family
@tiptap/extension-hard-break
@tiptap/extension-heading
@tiptap/extension-highlight
@tiptap/extension-horizontal-rule
@tiptap/extension-image
@tiptap/extension-invisible-characters
@tiptap/extension-italic
@tiptap/extension-link
@tiptap/extension-list
@tiptap/extension-mathematics
@tiptap/extension-mention
@tiptap/extension-node-range
@tiptap/extension-ordered-list
@tiptap/extension-paragraph
@tiptap/extension-subscript
@tiptap/extension-strike
@tiptap/extension-superscript
@tiptap/extension-table
@tiptap/extension-table-of-contents
@tiptap/extension-text
@tiptap/extension-text-align
@tiptap/extension-text-style
@tiptap/extension-twitch
@tiptap/extension-typography
@tiptap/extension-underline
@tiptap/extension-unique-id
@tiptap/extension-youtube
@tiptap/html
@tiptap/extensions
@tiptap/markdown
@tiptap/pm
@tiptap/react
@tiptap/starter-kit
@tiptap/static-renderer
@tiptap/vue-2
@tiptap/suggestion
@tiptap/vue-3
commit: |
|
@bdbch I see you self-assigned this. Let me know if there's anything you need from me to move this forward! |
bdbch
left a comment
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.
LGTM, thanks!
Changes Overview
There's a race condition that can occur in React StrictMode, that causes an already destroyed renderer to be re-added. This happens because
renderis called afterdestroy, andrenderthen callssetRenderer.Implementation Approach
Keep a
destroyedflag and don't callrenderfor already destroyed componentsTesting Done
Tested manually
Verification Steps
Additional Notes
Checklist
Related Issues