fix(resize): fix subflow resize on drag, children deselected in subflow on drag#2771
Merged
waleedlatif1 merged 4 commits intostagingfrom Jan 11, 2026
Merged
fix(resize): fix subflow resize on drag, children deselected in subflow on drag#2771waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryThis PR successfully fixes two related issues with subflow container behavior: Key Improvements1. Unified Container Dimension Calculation
2. Parent-Child Selection Conflict Resolution
3. Improved Paste/Duplicate Selection
ArchitectureThe changes follow a clean separation of concerns:
Issues FoundMinor race condition (low severity): Rapid successive paste operations could overwrite pending selections. See inline comment for details. Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ReactFlow
participant workflow.tsx
participant useNodeUtilities
participant helpers as workflow-canvas-helpers
participant Store
Note over User,Store: Subflow Container Resize During Drag
User->>ReactFlow: Drag child node inside container
ReactFlow->>workflow.tsx: onNodeDrag(nodeId, position)
workflow.tsx->>workflow.tsx: updateContainerDimensionsDuringDrag()
workflow.tsx->>useNodeUtilities: getBlockDimensions(childId)
useNodeUtilities-->>workflow.tsx: {width, height}
workflow.tsx->>useNodeUtilities: calculateContainerDimensions(childPositions)
Note over useNodeUtilities: Single source of truth:<br/>LEFT_PADDING + maxRight + RIGHT_PADDING<br/>HEADER + TOP_PADDING + maxBottom + BOTTOM
useNodeUtilities-->>workflow.tsx: {width, height}
workflow.tsx->>workflow.tsx: setDisplayNodes (update container dimensions)
ReactFlow-->>User: Visual feedback (container resizes live)
User->>ReactFlow: Drop child node
ReactFlow->>workflow.tsx: onNodeDragStop()
workflow.tsx->>Store: collaborativeBatchUpdatePositions()
Store->>workflow.tsx: blocks updated
workflow.tsx->>useNodeUtilities: calculateLoopDimensions()
useNodeUtilities->>useNodeUtilities: calculateContainerDimensions(childPositions)
Note over useNodeUtilities: Same calculation as during drag<br/>ensures no dimension jump
useNodeUtilities-->>workflow.tsx: {width, height}
workflow.tsx->>Store: updateNodeDimensions()
Note over User,Store: Parent-Child Selection Conflict Resolution
User->>ReactFlow: Select parent container
ReactFlow->>workflow.tsx: onNodesChange([{type: 'select'}])
workflow.tsx->>workflow.tsx: applyNodeChanges()
workflow.tsx->>helpers: resolveParentChildSelectionConflicts(nodes, blocks)
Note over helpers: Check each selected node:<br/>if parent also selected → deselect child
helpers-->>workflow.tsx: resolved nodes
workflow.tsx->>workflow.tsx: setDisplayNodes()
ReactFlow-->>User: Only parent selected (children deselected)
Note over User,Store: Paste with Selection
User->>workflow.tsx: Paste (Cmd+V)
workflow.tsx->>workflow.tsx: pendingSelectionRef = new Set(pastedIds)
workflow.tsx->>Store: collaborativeBatchAddBlocks()
Store->>workflow.tsx: blocks updated
Note over workflow.tsx: derivedNodes recomputes
workflow.tsx->>workflow.tsx: useEffect [derivedNodes, blocks]
workflow.tsx->>workflow.tsx: Check pendingSelectionRef
workflow.tsx->>helpers: resolveParentChildSelectionConflicts(withSelection, blocks)
helpers-->>workflow.tsx: resolved selection
workflow.tsx->>workflow.tsx: setDisplayNodes() + clear pendingSelectionRef
ReactFlow-->>User: Pasted nodes selected (respecting parent-child rules)
|
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx
Outdated
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-canvas-helpers.ts
Outdated
Show resolved
Hide resolved
Collaborator
Author
|
@greptile |
emir-karabeg
pushed a commit
that referenced
this pull request
Jan 14, 2026
…ow on drag (#2771) * fix(resize): fix subflow resize on drag, children deselected in subflow on drag * ack PR comments * fix copy-paste subflows deselecting children * ack comments
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
Type of Change
Testing
Tested manually
Checklist