fix(ops): fix subflow resizing on exit#2760
Merged
waleedlatif1 merged 6 commits intostagingfrom Jan 10, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile OverviewGreptile SummaryOverviewThis PR refactors workflow operations from individual updates to atomic batch operations, fixing the subflow resizing issue on exit. The core problem was that the old implementation updated blocks incrementally in a loop, causing multiple resize operations and potential race conditions. What Changed
How It Fixes Subflow ResizingOld approach (problematic): New approach (correct): The fix ensures that:
ArchitectureThe refactoring maintains proper separation of concerns:
All changes are backward compatible with the socket protocol (empty string represents parent removal, converted to Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant UI as workflow.tsx
participant Hook as use-collaborative-workflow
participant Store as workflow store
participant Socket as Socket Server
participant Remote as Remote Clients
Note over User,Remote: Removing Blocks from Subflow (New Batch Approach)
User->>UI: Click "Remove from Subflow"
UI->>UI: Collect all blocks and boundary edges
UI->>UI: Calculate absolute positions BEFORE mutations
UI->>UI: Build batch update array with edges
UI->>Hook: collaborativeBatchUpdateParent(updates)
Hook->>Store: batchRemoveEdges(edgeIds)
Store-->>Store: Remove all edges atomically
Hook->>Store: batchUpdateBlocksWithParent(updates)
Store-->>Store: Update all blocks atomically
Store-->>Store: Regenerate loops & parallels
Hook->>Socket: Queue batch-update-parent operation
Socket->>Remote: Broadcast batch-update-parent
Remote->>Remote: Apply batch updates locally
Store-->>UI: Trigger derivedNodes recalculation
UI->>UI: useEffect detects derivedNodes change
UI->>UI: resizeLoopNodesWrapper()
UI-->>User: Container properly resized
Note over User,Remote: Old Approach (Loop-based - PROBLEMATIC)
Note over UI: for each block:
Note over UI: removeEdges(block)
Note over UI: updateParent(block)
Note over UI: resize() <- Multiple resizes!
Note over UI: Result: Race conditions & incorrect sizing
|
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