feat(apollo-react): expose canvas handle positioning utility#812
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Dependency License Review
License distribution
Excluded packages
|
Contributor
📦 Dev Packages🧹 Dev packages cleaned up after PR close. Last updated: 2026-06-12 20:35:27 PT |
There was a problem hiding this comment.
Pull request overview
This PR extracts the grid-aligned side-handle slot positioning logic into a dedicated canvas utility and exposes it publicly so downstream canvas layout/tidy code can match Apollo’s rendered handle placement without duplicating the math.
Changes:
- Added
calculateGridAlignedHandlePositionstosrc/canvas/utils/handle-positioning.tswith dedicated unit tests. - Re-exported
calculateGridAlignedHandlePositionsfrom the public canvas utils barrel (and therefore from the rootcanvasbarrel). - Updated
ButtonHandle/SmartHandleto consume the shared helper; movedsnapToGridtests intoNodeUtils.test.tsand removed the old helper implementation fromButtonHandleStyleUtils.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/apollo-react/src/canvas/utils/NodeUtils.ts | Extends snapToGrid to accept a custom grid size parameter. |
| packages/apollo-react/src/canvas/utils/NodeUtils.test.ts | Adds unit tests covering snapToGrid default/custom grid behavior. |
| packages/apollo-react/src/canvas/utils/index.ts | Re-exports calculateGridAlignedHandlePositions from the public utils barrel. |
| packages/apollo-react/src/canvas/utils/handle-positioning.ts | Introduces the extracted public handle positioning utility. |
| packages/apollo-react/src/canvas/utils/handle-positioning.test.ts | Adds focused tests for handle positioning behavior and edge cases. |
| packages/apollo-react/src/canvas/components/ButtonHandle/ButtonHandle.tsx | Switches to importing handle positioning from the shared util. |
| packages/apollo-react/src/canvas/components/ButtonHandle/SmartHandle.tsx | Switches to importing handle positioning from the shared util. |
| packages/apollo-react/src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts | Removes the previous in-file snapToGrid and positioning helper implementation. |
| packages/apollo-react/src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.test.ts | Removes tests that were relocated to NodeUtils / handle-positioning tests. |
b3f5e94 to
71ced11
Compare
71ced11 to
8e6ac04
Compare
8e6ac04 to
e9705c1
Compare
e9705c1 to
d17386d
Compare
CalinaCristian
approved these changes
Jun 13, 2026
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.
Summary
calculateGridAlignedHandlePositionslogic fromButtonHandleStyleUtilsintosrc/canvas/utils/handle-positioning.tsso it can be shared with consumers.calculateGridAlignedHandlePositionsfrom the public canvas utils barrel, making it available from@uipath/apollo-react/canvas/utilsand the root canvas barrel.handle-positioning.ts;NodeUtils.snapToGridis not changed.ButtonHandleandSmartHandleto use the moved helper for rendering.Why
Downstream canvas layout/tidy code needs to align with Apollo's actual rendered side-handle slots without duplicating the placement math.
Validation
pnpm --dir packages/apollo-react exec vitest --run src/canvas/components/ButtonHandle src/canvas/utils/handle-positioning.test.tspnpm --dir packages/apollo-react exec tsc --noEmit --pretty false --project tsconfig.jsonpnpm --dir packages/apollo-react exec biome check src/canvas/components/ButtonHandle/ButtonHandle.tsx src/canvas/components/ButtonHandle/SmartHandle.tsx src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.test.ts src/canvas/utils/index.ts src/canvas/utils/handle-positioning.ts src/canvas/utils/handle-positioning.test.ts