Skip to content

Define edge types and create React Flow custom edge components#135

Merged
ricardozanini merged 1 commit intoserverlessworkflow:mainfrom
handreyrc:add-custom-edges
May 5, 2026
Merged

Define edge types and create React Flow custom edge components#135
ricardozanini merged 1 commit intoserverlessworkflow:mainfrom
handreyrc:add-custom-edges

Conversation

@handreyrc
Copy link
Copy Markdown
Contributor

Closes #52

Summary

This PR adds react flow edge types, customizable edge components and support to calculated waypoints.

Changes

  • Added edge types to initialize react flow with the supported ede types.
  • Added customizable edge react components for default, error and conditional edge types.
  • Added edge label support.
  • Added orthogonal behavior to nodes without predefined waypoints.
  • Added support to waypoints.
  • Added arrow to the end of the edges.
  • Added support to animated edges.
  • Tests ensuring that all three edge types are supported and renderable by react flow.
custom-edges.mp4

Copilot AI review requested due to automatic review settings May 1, 2026 00:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds custom React Flow edge types (default, condition, error) to the Serverless Workflow diagram editor, including waypoint-based routing, labels, and arrow markers, plus accompanying styling and tests.

Changes:

  • Introduces EdgeTypes mapping and custom edge renderers with label rendering and waypoint path support.
  • Updates the sample Diagram to use edge types, show labels/waypoints, and apply default arrow markers.
  • Adds CSS styling for edge strokes and edge labels, plus a new test suite for edge types and waypoint path generation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx New tests for edge type registration/rendering and createPathFromWayPoints.
packages/serverless-workflow-diagram-editor/src/styles.css Registers a new CSS layer for custom edge labels.
packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Adds custom edge components, label renderer, and waypoint-to-SVG-path helper.
packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Wires edgeTypes, edge sample data (types/labels/waypoints), and default arrow markers into React Flow.
packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css Adds styling for edge lines and edge labels (including layer usage).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/styles.css Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
@lornakelly
Copy link
Copy Markdown
Contributor

Thanks for Pr @handreyrc just added a few comments

Copilot AI review requested due to automatic review settings May 1, 2026 15:28
@handreyrc handreyrc force-pushed the add-custom-edges branch from 55418e9 to 26ef7c6 Compare May 1, 2026 15:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
@handreyrc handreyrc force-pushed the add-custom-edges branch from 26ef7c6 to 588825c Compare May 1, 2026 16:09
Copilot AI review requested due to automatic review settings May 1, 2026 17:03
@handreyrc handreyrc force-pushed the add-custom-edges branch from 588825c to d47810e Compare May 1, 2026 17:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
@handreyrc handreyrc force-pushed the add-custom-edges branch from d47810e to 38573d6 Compare May 1, 2026 17:22
@handreyrc handreyrc requested a review from lornakelly May 1, 2026 18:47
Copy link
Copy Markdown
Member

@fantonangeli fantonangeli left a comment

Choose a reason for hiding this comment

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

Thank you @handreyrc , I suggested the use of it.each to avoid repetitions in tests

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Copilot AI review requested due to automatic review settings May 4, 2026 14:01
@handreyrc handreyrc force-pushed the add-custom-edges branch from 38573d6 to bf4ada9 Compare May 4, 2026 14:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

@fantonangeli fantonangeli left a comment

Choose a reason for hiding this comment

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

LGTM thanks @handreyrc !

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/edges/Edges.tsx Outdated
Copilot AI review requested due to automatic review settings May 5, 2026 15:00
Copy link
Copy Markdown
Contributor

@lornakelly lornakelly left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serverless-workflow-diagram-editor/tests/react-flow/edges/Edges.test.tsx Outdated
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
@handreyrc handreyrc force-pushed the add-custom-edges branch from 11dfa6b to e26dccf Compare May 5, 2026 15:23
@handreyrc handreyrc requested a review from ricardozanini May 5, 2026 15:23
@handreyrc
Copy link
Copy Markdown
Contributor Author

@ricardozanini,

If you do not have further considerations this PR is good enough to be merged.

Thanks!

@ricardozanini ricardozanini merged commit 3406538 into serverlessworkflow:main May 5, 2026
8 checks passed
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.

feat: Define edge types and create React Flow edge components

5 participants