Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • remove presence for a solo user

Type of Change

  • Bug fix

Testing

Tested manually.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Oct 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Oct 31, 2025 5:47am

@waleedlatif1 waleedlatif1 merged commit 6cd82f0 into staging Oct 31, 2025
4 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/presence branch October 31, 2025 05:53
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR fixes a bug where solo users would see their own avatar in the presence indicator. The fix filters out the current user from the presence list by comparing user IDs.

Key Changes:

  • Modified usePresence hook to import and use useSession to get current user ID
  • Added filter to exclude users where user.userId === currentUserId from the presence list
  • Removed redundant code comments from avatar and socket handler files for cleaner code

Implementation:
The presence list from the socket server includes all users in a workflow room. By filtering out entries matching the current user's session ID, only other collaborators are displayed in the avatar stack. The filter is applied in the useMemo hook with currentUserId as a dependency to ensure proper reactivity when the session loads.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is straightforward and well-implemented. It uses a simple filter to remove the current user from the presence list, consistent with similar patterns used throughout the codebase. The implementation correctly adds the dependency to useMemo and follows existing code conventions.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-presence.ts 5/5 Added filter to exclude current user from presence list using session.user.id

Sequence Diagram

sequenceDiagram
    participant Client as Client Browser
    participant Hook as usePresence Hook
    participant Auth as Auth Session
    participant Socket as Socket Context
    participant Server as Socket Server
    
    Client->>Auth: Load user session
    Auth-->>Hook: session.user.id
    Client->>Socket: Connect to workflow
    Socket->>Server: join-workflow
    Server->>Server: Add user to room
    Server->>Socket: presence-update (all users)
    Socket-->>Hook: presenceUsers array
    Hook->>Hook: Filter out current user<br/>(user.userId !== currentUserId)
    Hook-->>Client: Return filtered users<br/>(excluding self)
Loading

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants