fix: Ignore block/inline content mutations which aren't useful (BLO-1224)#2912
fix: Ignore block/inline content mutations which aren't useful (BLO-1224)#2912matthewlipski wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughChangesNode view mutation filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
|
Summary
This PR makes blocks & inline content ignore all mutations which don't modify the block/inline content's content. By default, ProseMirror handles all DOM mutations to a node. This is to allow changes in the view to propagate to the state. For BlockNote, this isn't really needed - you're expected to update the state (e.g. by updating a block's props) and let those changes trigger a re-render to propagate them to the view.
This has a number of benefits. For one, interactive elements that are view-only and aren't tied to e.g. a block's props won't cause re-renders. Also, browser extensions may modify inline styles on elements in the editor. Because these are DOM mutations, ProseMirror picks them up and triggers a re-render, and ends up causing an infinite re-render loop.
Closes #2818
Rationale
We expect most people to create custom blocks using React, so these changes don't really apply there. So this PR is mostly to prevent issues with browser extensions like DarkReader.
Changes
ignoreNonContentMutations.Impact
N/A
Testing
Added unit tests.
Screenshots/Video
N/A
Checklist
Additional Notes
N/A
Summary by CodeRabbit
Bug Fixes
Tests