improvement(context-menu): added awareness for chat and variables being open, fixed select calculation to match height calculation for selecting multiple blocks#2715
Merged
waleedlatif1 merged 1 commit intostagingfrom Jan 7, 2026
Conversation
…ng open, fixed select calcaulation to match heihgt calculation for selecting multiple blocks
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR improves the context menu UX by making Chat and Variables menu items state-aware, displaying "Close" when panels are open instead of always showing "Open". Additionally, it fixes a bug in workflow block dimension calculations where the dependency array was tracking subBlockRows.length (number of rows) instead of the total count of subblocks, which caused selection area mismatches.
Key Changes:
- Context menu now reads panel state from
useVariablesStoreanduseChatStoreto display dynamic labels - Renamed handlers from
onOpen*toonToggle*to better reflect their toggle behavior - Fixed
workflow-block.tsxdependency to use.reduce((acc, row) => acc + row.length, 0)matching the height calculation logic - Added proper TypeScript documentation for new interface properties
Confidence Score: 5/5
- This PR is safe to merge with no identified issues
- The changes are well-structured, follow established patterns, fix a legitimate bug, and improve UX. The toggle handlers correctly use Zustand's
getState()pattern, the dependency fix aligns with the calculation logic, and all changes maintain type safety. - No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/context-menu/pane-context-menu.tsx | 5/5 | Updated to display dynamic labels for Chat and Variables based on their open/closed state |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/context-menu/types.ts | 5/5 | Added interface props for panel state tracking with proper TypeScript documentation |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx | 5/5 | Fixed dependency calculation to count total subblocks correctly for dimension updates |
| apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx | 5/5 | Refactored handlers to toggle panels and pass state to context menu |
Sequence Diagram
sequenceDiagram
participant User
participant ContextMenu as Context Menu
participant Workflow as workflow.tsx
participant VarStore as useVariablesStore
participant ChatStore as useChatStore
participant PaneMenu as PaneContextMenu
User->>ContextMenu: Right-click canvas
ContextMenu->>Workflow: Show context menu
Workflow->>VarStore: Get isOpen state
VarStore-->>Workflow: isVariablesOpen
Workflow->>ChatStore: Get isChatOpen state
ChatStore-->>Workflow: isChatOpen
Workflow->>PaneMenu: Render with states
PaneMenu-->>User: Display "Open/Close Chat/Variables"
alt User clicks Toggle Variables
User->>PaneMenu: Click menu item
PaneMenu->>Workflow: onToggleVariables()
Workflow->>VarStore: getState() { isOpen, setIsOpen }
Workflow->>VarStore: setIsOpen(!isOpen)
VarStore-->>Workflow: State updated
end
alt User clicks Toggle Chat
User->>PaneMenu: Click menu item
PaneMenu->>Workflow: onToggleChat()
Workflow->>ChatStore: getState() { isChatOpen, setIsChatOpen }
Workflow->>ChatStore: setIsChatOpen(!isChatOpen)
ChatStore-->>Workflow: State updated
end
waleedlatif1
added a commit
that referenced
this pull request
Jan 8, 2026
…ng open, fixed select calculation to match height calculation for selecting multiple blocks (#2715)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
close chatandclose variablesif they are open, instead of always just sayingOpen ChatType of Change
Testing
Tested manually
Checklist