Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Fix context menu to preserve multi-selection when right-clicking an already selected block
  • Remove non-TSDoc comments from sidebar context menu hook

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 Jan 25, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 25, 2026 5:58am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 25, 2026

Greptile Overview

Greptile Summary

Fixed context menu selection behavior to preserve multi-selection when right-clicking already selected blocks, and cleaned up non-TSDoc comments.

  • Context menu logic improvement: Refactored handleNodeContextMenu to check if clicked node is already selected before modifying selection state, preventing unexpected deselection
  • Comment cleanup: Removed non-TSDoc comments from sidebar context menu hook per global standards
  • Note: Canvas context menu hook is now missing TSDoc documentation for the exported function

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it's a focused bug fix with improved UX logic
  • The logic change correctly addresses the selection preservation issue with clear conditional flow. The only minor issue is the removal of TSDoc from the canvas hook which should be added back for consistency
  • No files require special attention - the logic is straightforward and improves the existing behavior

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-canvas-context-menu.ts Fixed selection preservation logic to maintain multi-selection when right-clicking already selected blocks, improving UX by preventing unexpected deselection
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu.ts Removed non-TSDoc comments while preserving TSDoc documentation, improving code consistency per project standards

Sequence Diagram

sequenceDiagram
    participant User
    participant ContextMenu as handleNodeContextMenu
    participant Nodes as Node State
    participant Menu as Context Menu

    alt Right-click on already selected node
        User->>ContextMenu: Right-click selected node
        ContextMenu->>Nodes: getNodes().filter(selected)
        Note over ContextMenu: isClickedNodeSelected = true
        ContextMenu->>ContextMenu: nodesToUse = currentSelectedNodes
        Note over ContextMenu: No selection state change
        ContextMenu->>Menu: Show menu with all selected
    else Right-click with multi-select modifier
        User->>ContextMenu: Shift/Cmd/Ctrl + Right-click
        ContextMenu->>Nodes: getNodes().filter(selected)
        Note over ContextMenu: isMultiSelect = true
        ContextMenu->>Nodes: Add clicked node to selection
        ContextMenu->>ContextMenu: nodesToUse = [...selected, node]
        ContextMenu->>Menu: Show menu with updated selection
    else Right-click without modifiers
        User->>ContextMenu: Right-click unselected node
        Note over ContextMenu: Single select mode
        ContextMenu->>Nodes: Select only clicked node
        ContextMenu->>ContextMenu: nodesToUse = [node]
        ContextMenu->>Menu: Show menu for single node
    end
    
    ContextMenu->>Menu: setPosition(x, y)
    ContextMenu->>Menu: setSelectedBlocks(nodesToBlockInfos)
    ContextMenu->>Menu: setActiveMenu('block')
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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit e14cebe into staging Jan 25, 2026
17 of 18 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/select branch January 25, 2026 06:05
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