fix(builder): batch multi-select drag position saves atomically - #46
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Concurrent per-node PATCH requests during multi-select drag used read-modify-write on the full nodes array, so the last write could revert another node's new position. Coalesce drag-stop updates into one workflow PATCH per microtask batch. Co-authored-by: esadrianno <esadrianno@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Bug and impact
Multi-select drag on the workflow canvas silently lost one node's persisted position after reload. Users could drag two or more selected nodes together, but only one node's new coordinates were saved.
Root cause
handleNodeDragStopfired once per dragged node and issued separatePATCH /nodes/:idrequests. The server updates nodes via read-modify-write on the fullnodesarray (getWorkflow→ map one node →updateWorkflow). Concurrent PATCHes read the same pre-drag snapshot; whichever completed last overwrote the other node's old position.Fix
Coalesce drag-stop position updates into a single
PATCH /api/workflows/:idwith the full updatednodesarray per microtask batch. Added a unit test that simulates two synchronous drag-stop events and asserts one atomic workflow PATCH.Validation
pnpm run test:run tests/components/use-builder-graph-mutations.test.tsx