Skip to content

feat(sdk): edge template prop#28

Open
kacpercierzniewski wants to merge 6 commits into
mainfrom
WB-220-edge-template-prop
Open

feat(sdk): edge template prop#28
kacpercierzniewski wants to merge 6 commits into
mainfrom
WB-220-edge-template-prop

Conversation

@kacpercierzniewski

Copy link
Copy Markdown
Contributor

No description provided.

kacpercierzniewski and others added 5 commits June 3, 2026 09:46
The demo custom edge painted a fixed stroke, so it didn't highlight on
select/hover like the built-in edges — a misleading reference. Delegate
styling to the SDK's exported useLabelEdgeHover (the same hook LabelEdge
uses), keeping only strokeDasharray on top. Selected/hover now match the
built-in edge while the edge stays visually dashed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
// `useEdgeTypes` resolves the built-in default plus any Root-level
// `edgeTemplates`. The local `edgeTypes` prop (direct DiagramContainer mount)
// is merged last so an explicit per-mount override still wins.
const resolvedEdgeTypes = useEdgeTypes();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

resolvedEdgeTypes and root-level sound very mysterious and don't tell developers what they are.

Maybe something like this would be better?

// It returns the default built-in edge types in WorkflowBuilder,
// for example with ELK, or edges injected by plugins ex. avoiding nodes.
const defaultEdgeTypes = useEdgeTypes();
// EdgeTypes are custom edge types passed as a prop.
const diagramEdgeTypes = useMemo(() => ({ ...resolvedEdgeTypes, ...edgeTypes }), [resolvedEdgeTypes, edgeTypes]);

Rename the vague `resolvedEdgeTypes` local to `baseEdgeTypes` and correct
the comment: the value is the built-in `labelEdge` renderer plus app-wide
`edgeTemplates` from <WorkflowBuilder.Root>, which the per-mount `edgeTypes`
prop overrides — not plugin- or ELK-injected edges.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants