RTC: Deduplicate collaborators list by WordPress user ID#78736
Draft
amitraj2203 wants to merge 1 commit into
Draft
RTC: Deduplicate collaborators list by WordPress user ID#78736amitraj2203 wants to merge 1 commit into
amitraj2203 wants to merge 1 commit into
Conversation
|
Size Change: +123 B (0%) Total Size: 8.18 MB 📦 View Changed
ℹ️ View Unchanged
|
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.
What?
Closes #78700
When the same WordPress user has a post open in multiple browser tabs simultaneously, deduplicate the collaborators header avatars and popover list so they appear only once.
Why?
Each browser tab registers its own Yjs awareness
clientId. Because the presence list was keyed and rendered byclientId, a single user with two tabs open would appear as two separate entries — each with its own avatar and color. Other collaborators would perceive more concurrent editors than there actually are, and the user themselves would see their own avatar duplicated.How?
This is a render-layer change only. The underlying per-
clientIdYjs awareness state is left completely untouched so cursor and selection rendering in the editor overlay continues to work for each individual session.A
deduplicateByUserIdhelper groupsPostEditorAwarenessStateentries bycollaboratorInfo.id(the WordPress user ID) and keeps one canonical entry per user, chosen by priority:isMe: trueentry wins — preserves the "You" label and disabled state in the popover list.collaboratorInfo.enteredAt).Two call sites are updated in
CollaboratorsPresence:otherActiveCollaborators— now filters by both!c.isMeandc.collaboratorInfo.id !== me?.collaboratorInfo.id, so the current user's other tabs are excluded entirely from the header avatars.collaboratorsForList— deduplicated before sorting, so the popover list shows one row per user.CollaboratorsOverlayis not affected; it callsuseActiveCollaboratorsindependently and renders one cursor perclientIdas before.Testing Instructions
Multi-tab duplicate avatar:
Normal multi-user collaboration (regression check):
Testing Instructions for Keyboard
aria-label("Collaborators list, N online") matches the number of unique users visible.Screenshots or screencast