fix(react): prevent crash when ReactNodeViewRenderer returns early#7670
Open
cyphercodes wants to merge 1 commit intoueberdosis:mainfrom
Open
fix(react): prevent crash when ReactNodeViewRenderer returns early#7670cyphercodes wants to merge 1 commit intoueberdosis:mainfrom
cyphercodes wants to merge 1 commit intoueberdosis:mainfrom
Conversation
🦋 Changeset detectedLatest commit: d4a57cb The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 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 failed. Why did it fail? →
|
9626f09 to
98a3ab7
Compare
When contentComponent is not available, return a minimal valid NodeView with a placeholder DOM element instead of an empty object. This prevents ProseMirror from crashing with 'dom.hasAttribute is not a function' when using custom atom nodes with renderHTML returning text in the initial document. Fixes ueberdosis#7641
bdbch
approved these changes
Apr 3, 2026
| "ts-loader": "9.3.1", | ||
| "tsup": "^8.5.1", | ||
| "turbo": "2.3.3", | ||
| "typescript": "^5.7.3", |
Member
There was a problem hiding this comment.
I don't mind updating this, but I think we should remove it from this PR and keep it clean and focused on the specific fix, not generic dependency upgrades
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a custom atom node uses ReactNodeViewRenderer and exists in the initial document at parse time, the renderer could return an empty object if
contentComponentwasn't available yet. This caused ProseMirror to crash with:This happens because ProseMirror expects a valid NodeView with a
domproperty, but received an empty object.Solution
Return a minimal valid NodeView with a placeholder DOM element instead of an empty object when
contentComponentis not available. The placeholder NodeView implements all required methods with safe defaults.Fixes #7641