Skip to content

feat: support inserting dragged nodes into connections#40

Draft
zacharyfmarion wants to merge 1 commit into
mainfrom
codex/node-drag-edge-insert
Draft

feat: support inserting dragged nodes into connections#40
zacharyfmarion wants to merge 1 commit into
mainfrom
codex/node-drag-edge-insert

Conversation

@zacharyfmarion
Copy link
Copy Markdown
Owner

Summary

What changed

  • Added shared edge-hit and insertion-planning helpers so connection insertion logic is no longer duplicated inside NodeCanvas.
  • Reused that shared insertion flow for existing-node drags, so dropping a node over a compatible connection now splices it into the edge the same way library drags do.
  • Added focused Vitest coverage for edge proximity, compatible insertion selection, replacing an occupied dragged-node input, and cycle rejection.

Why

  • Keeps node insertion behavior consistent between node-library drags and in-canvas node moves.
  • Rejects unsafe existing-node insertions that would create cycles, instead of attempting a partial rewire.

Implementation notes

  • Implementation plan: implementation-plans/node-drag-connection-insert.md
  • Existing-node insertion disconnects any incoming connection on the reused input before wiring the dragged node into the hovered edge.

Testing

Coverage checklist

  • Backend unit tests added or updated for changed Rust behavior
  • Client unit/component tests added or updated for changed frontend behavior
  • E2E tests added or updated for net new user-facing flows
  • No new tests were needed for this change

Validation performed

  • cargo check --workspace
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --all -- --check
  • cargo bench --no-run --workspace
  • yarn lint
  • yarn lint:css
  • npx tsc -b --noEmit
  • yarn test src/components/edgeInsertion.test.ts
  • npx playwright test

Test details

  • Validated the new shared edge insertion helper with focused Vitest coverage.
  • Built the web WASM packages with yarn build:wasm before TypeScript validation so the generated bindings existed for tsc.
  • Skipped Rust validation because this change only touched apps/web/.
  • Skipped CSS lint because no CSS files changed.
  • Skipped Playwright because this change was covered with focused frontend unit tests and React Flow drag automation would have been substantially heavier than the targeted regression surface.

Performance

Performance impact

  • Performance was considered for this change
  • No meaningful performance impact is expected

Justification

  • The new helper only runs during library drop or node drag-stop events and reuses the same O(edges) proximity scan that already existed for node-library insertion.

UI changes

Screenshots or recordings

  • N/A

Issue link

  • Closes #

@zacharyfmarion zacharyfmarion force-pushed the codex/node-drag-edge-insert branch from 996618f to 082df3c Compare April 21, 2026 17:24
@zacharyfmarion
Copy link
Copy Markdown
Owner Author

This both broke the existing working behavior when dragging from the node library and also does not work for dragging a node once its already in the node editor over a connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant