Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • modal style standardization, select drop improvement

Type of Change

  • Bug fix
  • New feature

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 17, 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 17, 2026 9:11pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 17, 2026

Greptile Summary

This PR makes three distinct improvements to the workflow canvas and modal components:

  • Shift-selection lock: Created new useShiftSelectionLock hook that prevents selection from canceling when shift key is released mid-drag, improving multi-select UX on the canvas
  • Pending selection refactor: Moved pending selection state from component ref to Zustand store (pendingSelection in workflow registry), providing centralized state management for paste/duplicate operations
  • Code organization: Extracted utility functions (estimateBlockDimensions, clampPositionToContainer, calculateContainerDimensions) from hooks to dedicated node-position-utils.ts module, following separation of concerns
  • Modal standardization: Updated button variants across modals to use semantic variants (tertiary for save actions, destructive for delete actions) instead of custom CSS classes
  • Select component improvement: Replaced Combobox with ButtonGroup for authentication selection in A2A deploy modal, providing a more appropriate UI pattern for binary choices

The refactoring follows the codebase patterns by separating hooks (stateful logic) from utilities (pure functions) and improving import organization.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured refactorings and UI improvements with clear separation of concerns. The shift-selection fix addresses a real UX issue, the pending selection refactor improves state management, and the modal standardization follows established patterns. All changes are backwards-compatible and the code follows established architectural patterns.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-shift-selection-lock.ts Added new hook to lock shift-selection mode during drag operations
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/node-position-utils.ts Extracted node position utilities from hook to dedicated utility module
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Integrated shift-selection lock, moved pending selection from ref to store, updated imports
apps/sim/stores/workflows/registry/store.ts Added pending selection state management to store, cleaned up comments
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/a2a/a2a.tsx Replaced Combobox with ButtonGroup for authentication selection
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/byok/byok.tsx Standardized button variants (tertiary for save, destructive for delete)

Sequence Diagram

sequenceDiagram
    participant User
    participant Workflow as workflow.tsx
    participant ShiftHook as useShiftSelectionLock
    participant Store as Registry Store
    participant ActionBar as action-bar.tsx
    
    Note over User,ActionBar: Shift-Selection Fix Flow
    
    User->>Workflow: Press Shift + MouseDown on canvas
    Workflow->>ShiftHook: handleCanvasMouseDown(event)
    ShiftHook->>ShiftHook: Check isPaneTarget & isHandMode
    ShiftHook->>ShiftHook: setIsShiftSelecting(true)
    ShiftHook->>ShiftHook: Prevent text selection
    ShiftHook-->>Workflow: Return selectionProps
    Note over Workflow: selectionOnDrag: true<br/>panOnDrag: false<br/>selectionKeyCode: null
    
    User->>User: Release Shift (still dragging)
    Note over ShiftHook: Selection stays locked!
    
    User->>Workflow: MouseUp
    ShiftHook->>ShiftHook: handleMouseUp()
    ShiftHook->>ShiftHook: setIsShiftSelecting(false)
    
    Note over User,ActionBar: Pending Selection Fix Flow
    
    User->>ActionBar: Duplicate block
    ActionBar->>Store: setPendingSelection([newId])
    Store->>Store: Append to pendingSelection array
    ActionBar->>Store: collaborativeBatchAddBlocks()
    
    Note over Workflow: derivedNodes updates
    
    Workflow->>Store: Read pendingSelection
    Store-->>Workflow: [newId]
    Workflow->>Store: clearPendingSelection()
    Workflow->>Workflow: Apply selection to nodes
    Workflow->>Workflow: resolveParentChildSelectionConflicts()
    Workflow->>Workflow: setDisplayNodes(selected nodes)
    
    Note over User,ActionBar: Modal Standardization
    
    User->>User: Open BYOK modal
    Note over User: Save button uses variant='tertiary'<br/>Delete button uses variant='destructive'
    
    User->>User: Open A2A Deploy modal
    Note over User: Auth selection uses ButtonGroup<br/>instead of Combobox
Loading

@waleedlatif1 waleedlatif1 merged commit b8b2057 into staging Jan 17, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/ui branch January 17, 2026 21:31
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