Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • fix additional avatars showing for presence

Type of Change

  • Bug fix

Testing

Tested manually, removed unused component

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 Nov 12, 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 Nov 12, 2025 5:29pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 12, 2025

Greptile Overview

Greptile Summary

Fixed duplicate avatar display issue by removing redundant UserAvatarStack component from the workflow page. The PR eliminates two instances of the component that were rendering in workflow.tsx, consolidating presence indicators to the existing Avatars component in the sidebar.

Key changes:

  • Removed UserAvatarStack component and its subcomponents (control-bar implementation)
  • Deleted use-presence hook - presence is now accessed directly via useSocket context
  • Enhanced Avatars component with extracted UserAvatar subcomponent and image error handling
  • Removed unused exports from control-bar components index

The fix is clean and appropriate - the sidebar Avatars component already handles presence display correctly with proper filtering by workflow ID and current user exclusion.

Confidence Score: 5/5

  • This PR is safe to merge - it cleanly removes duplicate code without introducing new logic or risks
  • The changes are straightforward deletions of redundant components with no logical errors. The remaining Avatars component in the sidebar already has proper presence handling, image error states, and user filtering. All imports and references were properly cleaned up.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx 5/5 Removed import and two instances of UserAvatarStack component that were causing duplicate avatars
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components-new/workflow-list/components/workflow-item/avatars/avatars.tsx 5/5 Refactored to extract UserAvatar component, added image error handling with fallback to initials

Sequence Diagram

sequenceDiagram
    participant User
    participant Workflow as workflow.tsx
    participant Socket as SocketContext
    participant Avatars as Avatars Component

    Note over Workflow,Avatars: Before (Duplicate Avatars Issue)
    User->>Workflow: Views workflow page
    Workflow->>Socket: useSocket() - Get presence data
    Socket-->>Workflow: presenceUsers[]
    Workflow->>Workflow: Render UserAvatarStack #1
    Workflow->>Workflow: Render UserAvatarStack #2
    Note over Workflow: Two instances created<br/>duplicate avatars shown!

    Note over Workflow,Avatars: After (This PR Fix)
    User->>Workflow: Views workflow page
    Note over Workflow: UserAvatarStack removed<br/>No longer renders avatars
    User->>Avatars: Views workflow in sidebar
    Avatars->>Socket: useSocket() - Get presence data
    Socket-->>Avatars: presenceUsers[], currentWorkflowId
    Avatars->>Avatars: Filter by currentWorkflowId
    Avatars->>Avatars: Filter out current user
    Avatars->>Avatars: Add image error handling
    Avatars-->>User: Display single avatar stack
Loading

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.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit c7560be into staging Nov 12, 2025
9 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/presence branch November 12, 2025 17:33
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