Skip to content

fix(apollo-react): clear node faces so routed edges exit perpendicular [MST-11337]#834

Open
KodudulaAshishUiPath wants to merge 2 commits into
mainfrom
fix/MST-11337
Open

fix(apollo-react): clear node faces so routed edges exit perpendicular [MST-11337]#834
KodudulaAshishUiPath wants to merge 2 commits into
mainfrom
fix/MST-11337

Conversation

@KodudulaAshishUiPath

@KodudulaAshishUiPath KodudulaAshishUiPath commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Routed (auto-layout) edges on multi-handle nodes rendered with a kink right at the source/target handle — no perpendicular exit offset. This shifts the bend nearest each node face out to a fixed perpendicular STUB_OFFSET so edges leave and enter cleanly.

ELK computes bend points from its port positions, which differ from the rendered React Flow handle positions on multi-handle nodes (Decision true/false, Script main/error). The first/last routed bend lands at or behind the handle, so the edge jogs immediately instead of exiting straight.

Demo

Before:
Screenshot 2026-06-18 at 10 19 46
After:
Screenshot 2026-06-18 at 10 22 01

Files Changed

  • New clearNodeFace(waypoints, anchor, position) in geometry.ts: shifts the waypoint riser nearest a node face out to STUB_OFFSET (lands exactly STUB_OFFSET in front for any gap, including bends behind the face). Applied to both source and target faces in buildPathVertices.
  • Gated behind a new autoRouted flag, threaded buildPathVerticesuseEdgeGeometryCanvasEdge, so it only affects router-produced routedWaypoints; manual waypoints render exactly where the user placed them.
  • Shifting the stored waypoints (ids preserved) survives consolidateWaypoints, unlike a derived stub elbow.

Tests

New buildPathVertices / clearNodeFace cases: source + target shift, vertical (y-axis) face, behind-face forward-pull, and manual-not-shifted. 29 geometry / 85 Edges tests pass; biome + tsc clean.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 18, 2026 06:04
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (PT)
apollo-design 🟢 Ready Preview, Logs Jun 17, 2026, 11:48:33 PM
apollo-docs 🟢 Ready Preview, Logs Jun 17, 2026, 11:48:33 PM
apollo-landing 🟢 Ready Preview, Logs Jun 17, 2026, 11:48:33 PM
apollo-vertex 🟢 Ready Preview, Logs Jun 17, 2026, 11:48:33 PM

@github-actions

Copy link
Copy Markdown
Contributor

Dependency License Review

  • 1942 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1712
ISC 89
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Ready to approve

The change is well-scoped behind an autoRouted flag, and the new geometry behavior is covered by targeted regression tests.

Note: this review does not count toward required approvals for merging.

Pull request overview

This PR improves auto-routed (graph router/ELK) Canvas edge rendering for multi-handle nodes by ensuring routed edges exit/enter node faces with a consistent perpendicular “stub” offset, eliminating immediate kinks at handles while keeping manually placed waypoints untouched.

Changes:

  • Added clearNodeFace() to shift the nearest routed riser off node faces to EDGE_CONSTANTS.STUB_OFFSET, applied at both source and target in buildPathVertices.
  • Threaded a new autoRouted flag from CanvasEdgeuseEdgeGeometrybuildPathVertices to apply face-clearance only to router-produced waypoints.
  • Added unit tests covering source/target clearance, vertical faces, behind-face pulls, and manual-waypoint non-shifting.
File summaries
File Description
packages/apollo-react/src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts Adds autoRouted arg and passes it through to buildPathVertices.
packages/apollo-react/src/canvas/components/Edges/shared/geometry.ts Implements node-face clearance logic and applies it conditionally for auto-routed waypoints.
packages/apollo-react/src/canvas/components/Edges/shared/geometry.test.ts Adds regression/unit coverage for the new clearance behavior.
packages/apollo-react/src/canvas/components/Edges/CanvasEdge.tsx Sets autoRouted when rendering router-produced routedWaypoints (no manual waypoints).

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread packages/apollo-react/src/canvas/components/Edges/shared/geometry.ts Outdated
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core 9.0% 43.82 MB 57.31 MB ±0
@uipath/apollo-react 34.9% 100.0% (17/17) 7.24 MB 27.46 MB +680 B
@uipath/apollo-wind 38.4% 323.0 KB 2.22 MB −94 B
@uipath/ap-chat 85.8% 43.36 MB 55.68 MB ±0

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 18, 2026 06:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Not ready to approve

clearNodeFace currently determines the “nearest” riser via a global extremum across all waypoints, which can select the wrong segment for non-monotonic routed polylines and fail to clear the actual face-adjacent bend.

Copilot's findings
  • Files reviewed: 4/4 changed files
  • Comments generated: 2

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment on lines +167 to +170
const nearest = waypoints.reduce(
(acc, w) => (sign > 0 ? Math.min(acc, w[axis]) : Math.max(acc, w[axis])),
sign > 0 ? Infinity : -Infinity
);
Comment on lines +156 to +162
/**
* Push the waypoint riser nearest a node face (`anchor` = inset source/target
* endpoint) out to STUB_OFFSET when it sits closer than that (gap < STUB_OFFSET),
* so the edge keeps a perpendicular offset. This includes bends behind the face
* (gap < 0), which are pulled forward in front of the face.
* survives consolidation where a derived elbow would not.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:apollo-react size:L 100-499 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants