refactor: extract insertEdge private method in BpmnRenderer#3524
Merged
Conversation
Mirror the existing insertVertex helper by extracting an insertEdge private method that encapsulates edge cell creation, waypoints insertion, and label-bounds geometry. The previous insertEdges loop inlined all three concerns, producing an asymmetry with the shape path where insertVertex already encapsulates the equivalent responsibilities. The waypoint-before-label-bounds ordering is preserved inside the new helper because computeEdgeCenter reads edge.geometry.points, which is set by insertWaypoints. Message flow icon insertion stays at the loop level since it is a separate child-cell concern rather than part of the edge cell geometry. No behavior change: build, unit tests (BpmnRenderer.test.ts, 38 tests) and integration tests (14 suites, 312 tests) all pass.
|
♻️ PR Preview 4e271dc has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
|
♻️ PR Preview 4e271dc has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
Reduce insertEdge from 8 parameters to 1 by passing the Edge model directly instead of pre-derived primitives. SonarCloud flagged the previous signature as exceeding its 7-parameter threshold; the fix also aligns the helper with the existing insertShape pattern, which takes a Shape and derives parent/style/labelBounds internally. The default parent, source/target cells, label bounds and style are all derivable from the Edge model itself, so keeping them as parameters duplicated the caller logic. The new shape (insertEdges loop → insertEdge(internalEdge)) mirrors insertShapes → insertShape(shape) line for line. No behavior change: build, unit tests (38) and integration tests (14 suites, 312 tests) all pass.
|
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.




Mirror the existing insertVertex helper by extracting an insertEdge private method that encapsulates edge cell
creation, waypoints insertion, and label-bounds geometry. The previous insertEdges loop inlined all three concerns,
producing an asymmetry with the shape path where insertVertex already encapsulates the equivalent responsibilities.
The waypoint-before-label-bounds ordering is preserved inside the new helper because computeEdgeCenter reads
edge.geometry.points, which is set by insertWaypoints. Message flow icon insertion stays at the loop level since it
is a separate child-cell concern rather than part of the edge cell geometry.
No behavior change: build, unit tests (BpmnRenderer.test.ts, 38 tests) and integration tests (14 suites, 312 tests)
all pass.