-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Notes: Support multiple note threads per block #75147
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
base: trunk
Are you sure you want to change the base?
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +236 B (+0.01%) Total Size: 3 MB
ℹ️ View Unchanged
|
What?
Enables multiple independent note threads to be attached to a single block. Previously, each block could only have one top-level note, with subsequent notes forced to be replies.
Closes #75145
Why?
Fixes #74751 - Real-time collaboration race condition where two users adding notes simultaneously causes one to be orphaned.
Unblocks #74852 - Partial text selection notes feature requires multiple threads per block.
How?
Extends the existing
noteIdmetadata field to support either a scalar (legacy) or array format:Core Changes
Utility functions (
utils.js):getNoteIdsFromMetadata()- normalizes both formats to arrayaddNoteIdToMetadata()- appends to array, prevents duplicatesremoveNoteIdFromMetadata()- removes specific ID from arrayHook updates (
hooks.js):useBlockComments()- builds array-based block→notes mappingsonCreate()- appends new noteId instead of overwritingonDelete()- removes specific noteId, usescomment.blockClientIdfor correct targetingSidebar components (
index.js,comments.js):Backwards Compatibility
noteId: 42and arraynoteId: [1, 2, 3]Testing Instructions
Automated Tests
npm run test:unit -- --testPathPattern=collab-sidebarAI usage
I used Claude code extensively to help me analyze the current approach and come up with a plan. Claude wrote the initial Issue which I modified by adding some acceptance criteria, then passed back to Claude to develop an implementation plan. Claude write the code which I then reviewed. Claude created the PR which I then edited.
Next, I asked Code Rabbit to review the code changes locally.
Once the AI has completed its work, I plan to manually test the implementation in my local environment.
Screenshots or screencast
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com