-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(ops): fix subflow resizing on exit #2760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
Summary
Type of Change
Testing
tested manually
Checklist