feat!: use registry metadata for edge handle visibility#1040
feat!: use registry metadata for edge handle visibility#1040redfish4ktc wants to merge 4 commits intomainfrom
Conversation
The hard-coded reference to EdgeStyle.EntityRelation in EdgeHandler.isHandleVisible()
created a direct dependency on the EntityRelation function, preventing tree-shaking
when EntityRelation is not used in the application. It also meant only EntityRelation
could influence handle visibility — no other edge style (including custom ones) could
control whether intermediate bend handles are shown.
Replace this with an allowIntermediateHandles metadata property on EdgeStyleRegistry,
following the existing pattern of isOrthogonal and handlerKind.
Benefits:
- Generic: any edge style can now control intermediate handle visibility via metadata
- Configurable and extensible: custom edge styles can set allowIntermediateHandles: false
- Tree-shakeable: EdgeHandler no longer imports EdgeStyle directly
BREAKING CHANGE:
- EdgeStyleRegistryInterface has a new allowsIntermediateHandles() method
- Custom registrations of EntityRelation (e.g. when using BaseGraph) must now include
{ allowIntermediateHandles: false } in the metadata to preserve the previous behavior
WalkthroughReplaces a hardcoded Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.claude/rules/git/commit-conventions.md (1)
21-21: Please keep this docs-only convention change out of this feature PR (or justify it explicitly).At Line 21, updating commit-body wrap width is unrelated to the edge-style registry/handle-visibility objective and makes the PR harder to review and release safely. Prefer a separate docs/chore PR for this change.
Based on learnings: User tbouffard prefers to keep PRs focused on their main objective and defer unrelated improvements to dedicated PRs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3c26c5a9-5fac-4520-943b-0ee92208e167
📒 Files selected for processing (9)
.claude/rules/git/commit-conventions.mdCHANGELOG.mdpackages/core/__tests__/view/handler/EdgeHandler.test.tspackages/core/__tests__/view/style/EdgeStyleRegistry.test.tspackages/core/src/types.tspackages/core/src/view/handler/EdgeHandler.tspackages/core/src/view/style/edge/EdgeStyleRegistry.tspackages/core/src/view/style/register.tspackages/website/docs/usage/edge-styles.md
|



Overview
The hard-coded reference to EdgeStyle.EntityRelation in EdgeHandler.isHandleVisible()
created a direct dependency on the EntityRelation function, preventing tree-shaking
when EntityRelation is not used in the application. It also meant only EntityRelation
could influence handle visibility — no other edge style (including custom ones) could
control whether intermediate bend handles are shown.
Replace this with an allowIntermediateHandles metadata property on EdgeStyleRegistry,
following the existing pattern of isOrthogonal and handlerKind.
Benefits:
BREAKING CHANGE:
{ allowIntermediateHandles: false } in the metadata to preserve the previous behavior
Notes
Closes #978
I did a search to check if EdgeStyle is referenced elsewhere in the code.
With the exception of the function that stores the default value “EdgeStyle” and the loop described in section #758, there are no other references.
Impact on the bundle size
When
EntityRelationis not used by the application, the decrease is ~2kB.Note that the size increases in js-example and ts-example because EntityRelation is registered (in the list of default EdgeStyles loaded in this case), so the change made in this PR has no effect; this PR actually includes new code designed to manage the visibility of identifiers. It is this new code that is causing the increase.
Summary by CodeRabbit
Breaking Changes
New Features
Documentation
Tests
Chores