fix(designer): re-point preview edges when a relationship changes From/To - #114
Open
Minsup Lee (m1nsuppp) wants to merge 1 commit into
Open
fix(designer): re-point preview edges when a relationship changes From/To#114Minsup Lee (m1nsuppp) wants to merge 1 commit into
Minsup Lee (m1nsuppp) wants to merge 1 commit into
Conversation
Author
|
@microsoft-github-policy-service agree |
Minsup Lee (m1nsuppp)
force-pushed
the
fix/designer-edge-endpoints
branch
from
September 1, 2026 13:27
052ebc3 to
022a96a
Compare
Minsup Lee (m1nsuppp)
force-pushed
the
fix/designer-edge-endpoints
branch
from
September 1, 2026 13:28
022a96a to
59660bc
Compare
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.
The bug
Changing a relationship's From or To in the designer does not move its
edge in the graph preview. The edge stays attached to the entities it was first
drawn between, while the relationship form, the RDF tab and the exported
.rdfall show the new endpoints.
Reproduce
/#/designerBook,Author,Member)Following the
Building Your First Ontology
tutorial surfaces this at step 3: the form reads
Book → Authorwhile the graphdraws
Member → Author.Cause
GraphPreviewsyncs incrementally instead of rebuilding the graph: elements areadded or removed by id, and the rest are patched in place.
Re-pointing a relationship keeps its id, so its edge is in both
currentEdgeIdsand
desiredEdgeIds; it is neither removed nor re-added. The update loop thenonly patched the label:
Patching
source/targetviadata()would not have helped either: Cytoscapetreats them as immutable, so the edge has to be rebuilt.
The fix
Rebuild an edge whenever its endpoints no longer match its relationship. Node
positions are untouched, so the graph does not jump.
Tests
syncGraphElementsis extracted from the effect so it can be covered by tests:rendering the component needs a canvas that jsdom does not provide, but the
extracted function runs against a headless Cytoscape instance. Six cases cover
re-pointing the source, re-pointing the target, renaming only, position
stability, and deletion.
Reverting just the fix fails exactly the two re-pointing tests.
Most of the diff is the indentation change from that extraction. Reviewing with
"Hide whitespace" leaves about 20 changed lines.
Checks
npm test→ 400 passed (25 files)npx tsc -b→ cleannpx eslinton the changed files → cleanFiles (2)