Skip to content

fix(apollo-react): keep auto-routed canvas edges orthogonal [MST-13255] - #1021

Merged
snuziale merged 1 commit into
mainfrom
agent/fix-edge-collinearity
Aug 7, 2026
Merged

fix(apollo-react): keep auto-routed canvas edges orthogonal [MST-13255]#1021
snuziale merged 1 commit into
mainfrom
agent/fix-edge-collinearity

Conversation

@KodudulaAshishUiPath

@KodudulaAshishUiPath KodudulaAshishUiPath commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix the diagonal fallback in calculateAutoWaypoints by replacing the MIN_SEGMENT_LENGTH / 2 (16px) threshold with a real collinearity check at COLLINEAR_TOLERANCE (1px).
  • Add regression coverage for slight endpoint displacement.

CanvasEdge could fall back to a diagonal path after a small node displacement. calculateAutoWaypoints skipped the mid-axis jog whenever the endpoints were within 16px on the cross-axis, so any offset from 1-16px rendered as a single diagonal rather than an orthogonal route. The check now skips the jog only when the endpoints are genuinely collinear (within 1px); every other offset gets a proper elbow pair.

Explicit and routed waypoint paths are unchanged.

Demo

Before:

Screen.Recording.2026-08-06.at.15.50.56.mov

After:

Screen.Recording.2026-08-06.at.15.50.08.mov

Validation

  • vitest run src/canvas/components/Edges/ - 89 passed
  • tsc --noEmit - clean
  • Biome - clean on changed files

Copilot AI review requested due to automatic review settings August 6, 2026 10:28
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Aug 07, 2026, 01:15:48 AM
apollo-docs Ready Preview · Logs Aug 07, 2026, 01:15:48 AM
apollo-landing Ready Preview · Logs Aug 07, 2026, 01:15:48 AM
apollo-vertex Ready Preview · Logs Aug 07, 2026, 01:15:48 AM

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Dependency License Review

  • 1950 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1720
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.3.2 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.

Pull request overview

Aligns CanvasEdge rendering with SequenceEdge by using smooth-step routing for edges that have no explicit/routed waypoints, and tightens auto-waypoint behavior to avoid diagonal fallbacks after small endpoint displacements.

Changes:

  • Treat routing: 'waypoint' + waypoints.length === 0 as a smooth-step path in useEdgeGeometry.
  • Introduce shared collinearity detection (getCollinearAxis) and use it in calculateAutoWaypoints to preserve orthogonality for small endpoint offsets.
  • Add regression tests to ensure buildPathVertices remains orthogonal under slight target displacement.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/apollo-react/src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts Switches empty-waypoint waypoint routing to smooth-step path/label computation.
packages/apollo-react/src/canvas/components/Edges/shared/geometry.ts Adds collinearity helper and updates auto-waypoint routing logic.
packages/apollo-react/src/canvas/components/Edges/shared/geometry.test.ts Adds regression coverage for small endpoint offsets staying orthogonal.

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

github-actions Bot commented Aug 6, 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 43.84 MB 57.45 MB ±0
@uipath/apollo-react 39.1% 50.0% (4/8) 7.51 MB 28.87 MB +133 B
@uipath/apollo-wind 420.5 KB 2.73 MB +10 B
@uipath/ap-chat 85.8% 43.46 MB 56.05 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.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Storybook visual diff

⚠️ Visual changes detected: 7 changed (of 300 compared, 293 unchanged). View report

Baseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs

Updated (PT): Aug 07, 2026, 01:31:46 AM

@KodudulaAshishUiPath
KodudulaAshishUiPath force-pushed the agent/fix-edge-collinearity branch from 3cea6d9 to fd5eea0 Compare August 6, 2026 11:05
@KodudulaAshishUiPath KodudulaAshishUiPath changed the title fix(apollo-react): align auto-routed canvas edges fix(apollo-react): align auto-routed canvas edges [MST-13255] Aug 6, 2026
Copilot AI review requested due to automatic review settings August 6, 2026 11:17
@KodudulaAshishUiPath
KodudulaAshishUiPath force-pushed the agent/fix-edge-collinearity branch from fd5eea0 to a8a546d Compare August 6, 2026 11:17
@KodudulaAshishUiPath
KodudulaAshishUiPath marked this pull request as ready for review August 6, 2026 11:17

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/apollo-react/src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts:103

  • isSmoothStepPath causes this hook to return the useEdgePath smooth-step output, but the waypoint pipeline still recomputes buildPathVertices/createRoundedPath whenever coordinates change. In read-only/non-edit mode (where enableSegments is false) this adds unnecessary per-render work for auto-routed edges.
  const isWaypoint = routing === 'waypoint';
  const isHandle = routing === 'handle';
  const isSmoothStepPath = isHandle || (isWaypoint && waypoints.length === 0 && !enableSegments);

  const pathPoints = useMemo(

Comment thread packages/apollo-react/src/canvas/components/Edges/shared/hooks/useEdgeGeometry.ts Outdated
Copilot AI review requested due to automatic review settings August 7, 2026 08:10
@KodudulaAshishUiPath
KodudulaAshishUiPath force-pushed the agent/fix-edge-collinearity branch from a8a546d to 663cbfd Compare August 7, 2026 08:10
@KodudulaAshishUiPath KodudulaAshishUiPath changed the title fix(apollo-react): align auto-routed canvas edges [MST-13255] fix(apollo-react): keep auto-routed canvas edges orthogonal [MST-13255] Aug 7, 2026

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/apollo-react/src/canvas/components/Edges/shared/geometry.ts:36

  • The JSDoc sentence has an unnecessary comma (“shares, when…”) which reads like a grammatical error and makes the description harder to parse.
/** The axis a source/target pair already shares, when both faces exit along it
 * and the cross-axis offset is within {@link EDGE_CONSTANTS.COLLINEAR_TOLERANCE}.
 * `null` when they are offset enough to need a mid-axis jog, or when the faces
 * exit on different axes (an L-shape, which never needs one). */

@snuziale
snuziale merged commit 46f2771 into main Aug 7, 2026
45 of 47 checks passed
@snuziale
snuziale deleted the agent/fix-edge-collinearity branch August 7, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:apollo-react size:M 30-99 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants