Skip to content

fix: scope edge movement to current graph - #551

Open
caydyan wants to merge 1 commit into
open-source-labs:mainfrom
caydyan:codex/svelvet-edge-container-scope
Open

fix: scope edge movement to current graph#551
caydyan wants to merge 1 commit into
open-source-labs:mainfrom
caydyan:codex/svelvet-edge-container-scope

Conversation

@caydyan

@caydyan caydyan commented Jun 14, 2026

Copy link
Copy Markdown

Summary

Fixes #513.

Edges were being moved with document.querySelector('.svelvet-graph-wrapper'), which always returns the first Svelvet graph wrapper on the page. In pages with multiple Svelvet instances, that caused edges from later instances to be appended into the first graph.

This changes edge movement to use edgeElement.closest('.svelvet-graph-wrapper'), so each edge is appended to the graph wrapper it was rendered inside. It also avoids removing the edge when it is already parented by the correct wrapper.

Test coverage

Added a jsdom unit test that builds two .svelvet-graph-wrapper containers and verifies an edge from the second wrapper stays under that second wrapper instead of moving to the first one.

Validation

  • npm run test:unit -- tests/unit-tests/components/edgeMove.test.ts
  • npm run test:unit
  • npx prettier --check src/lib/components/Edge/Edge.svelte tests/unit-tests/components/edgeMove.test.ts
  • npx eslint src/lib/components/Edge/Edge.svelte tests/unit-tests/components/edgeMove.test.ts
  • npm run build

Known existing failure:

  • npm run check still reports the existing repo-wide 64 errors / 5 warnings in unrelated files such as DrawerController.svelte, createGraph.ts, route examples, and existing tests.

Sphinx bounty #2284 payout address: bc1qev5ant33v5y89qqjvcf4mh9hlax5svqf5xd7gc.

@caydyan

caydyan commented Jun 14, 2026

Copy link
Copy Markdown
Author

Current-head validation rerun on 88b58e5f4cfdcec9074c6a9632ec6d5d008e1d3d:

  • git diff --check origin/main...HEAD
  • npm run test:unit -- tests/unit-tests/components/edgeMove.test.ts (1 test passed)
  • npm run test:unit (5 suites / 10 tests passed)
  • npx prettier --check src/lib/components/Edge/Edge.svelte tests/unit-tests/components/edgeMove.test.ts
  • npx eslint src/lib/components/Edge/Edge.svelte tests/unit-tests/components/edgeMove.test.ts
  • npm run build (build/package/publint completed; existing route a11y/unused CSS warnings only)

Local worktree is clean after the rerun.

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.

Edges appending to only one instance of Svelvet container

1 participant