-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(presence): show presence for the same user in another tab, fix z-index of multiplayer cursor to fall behind panel,terminal,sidebar but above blocks, improved connection detection #2844
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
Conversation
…, fix z-index of multiplayer cursor to fall behind panel,terminal,sidebar but above blocks, improved connection detection
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR enables multi-tab presence for the same user and fixes cursor layering. Changed from filtering by Key changes:
The upsert logic in cursor/selection handlers (lines 406-448) addresses the race condition where cursor/selection events could arrive before the authoritative presence broadcast, ensuring users are always visible even if events arrive out of order. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client (Tab)
participant Socket as Socket Provider
participant Server as Socket.IO Server
participant Other as Other Clients
Note over Client,Server: Connection & Presence Setup
Client->>Socket: Initialize connection
Socket->>Server: connect (with auth token)
Server->>Socket: connect event
Socket->>Socket: setCurrentSocketId(socketInstance.id)
Socket->>Server: join-workflow(workflowId)
Server->>Socket: presence-update(all users)
Socket->>Socket: setPresenceUsers (merge with existing cursor/selection)
Server->>Other: presence-update(including new user)
Note over Client,Server: Cursor Updates (Race Condition Handling)
Client->>Socket: emitCursorUpdate({x, y})
Socket->>Server: cursor-update event
Server->>Other: broadcast cursor-update
Other->>Socket: receive cursor-update
Socket->>Socket: Check if user exists in presenceUsers
alt User exists
Socket->>Socket: Update cursor for existing user
else User doesn't exist (race condition)
Socket->>Socket: Upsert new user with cursor data
end
Server->>Other: presence-update (periodic/on join)
Socket->>Socket: Merge presence with existing cursor/selection state
Note over Client,Server: Filtering & Display
Socket->>Client: presenceUsers + currentSocketId
Client->>Client: Filter by socketId !== currentSocketId
Client->>Client: Render cursors/avatars (same user, different tabs visible)
|
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.
3 files reviewed, 2 comments
Summary
Type of Change
Testing
Tested manually
Checklist