Skip to content

feat: Define node types and create React Flow node components #51#108

Open
handreyrc wants to merge 1 commit intoserverlessworkflow:mainfrom
handreyrc:add-reactflow-nodes
Open

feat: Define node types and create React Flow node components #51#108
handreyrc wants to merge 1 commit intoserverlessworkflow:mainfrom
handreyrc:add-reactflow-nodes

Conversation

@handreyrc
Copy link
Copy Markdown
Contributor

Closes #51

Summary

This PR adds react flow node types and customizable node components for each task type also reenabling base behaviours such as borders, selection / deselection and mouse hover.

Changes

  • Added node types to initialize react flow with the supported node types.
  • Added customizable node react components for each one of the twelve tasks in the spec 1.0 .
  • Added default node size.
  • Added CSS styles to reestablish borders and default behaviors of the nodes (selection / deselection and hover).
  • Updated storybook to render and present the twelve supported node types.
  • Tests ensuring that all twelve node types are supported and renderable by react flow.
image

Copilot AI review requested due to automatic review settings April 21, 2026 20:40
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

This PR introduces React Flow custom node types/components for the 12 Serverless Workflow task types, wires them into the diagram renderer, and adds styling + tests to validate that the custom nodes are renderable.

Changes:

  • Added a NodeTypes mapping and placeholder React Flow node components for the 12 task types.
  • Updated the React Flow Diagram to use these node types and a shared default node size.
  • Added CSS to restore node border/hover/selection behaviors and added/updated unit tests around Diagram + node rendering.

Reviewed changes

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

Show a summary per file
File Description
pnpm-lock.yaml Bumps vitest-related packages and oxlint versions in the lockfile.
packages/serverless-workflow-diagram-editor/src/react-flow/nodes/Nodes.tsx Defines NodeTypes and placeholder custom node components for all 12 task types.
packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Uses NodeTypes, sets node type to GraphNodeType.*, and applies default sizing/test ids.
packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css Adds styling for node border/hover/selection behavior.
packages/serverless-workflow-diagram-editor/src/core/autoLayout.ts Introduces DEFAULT_NODE_SIZE for reuse across diagram/tests.
packages/serverless-workflow-diagram-editor/tests/react-flow/nodes/Nodes.test.tsx Adds a test that renders all 12 custom node types and asserts they exist.
packages/serverless-workflow-diagram-editor/tests/react-flow/diagram/Diagram.test.tsx Updates Diagram test to assert container/canvas presence via test ids.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/nodes/Nodes.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/nodes/Nodes.tsx 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/nodes/Nodes.test.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/core/autoLayout.ts
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/nodes/Nodes.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/nodes/Nodes.tsx Outdated
@handreyrc handreyrc force-pushed the add-reactflow-nodes branch from 7366ab6 to ff45b5a Compare April 21, 2026 21:01
Copilot AI review requested due to automatic review settings April 21, 2026 21:10
@handreyrc handreyrc force-pushed the add-reactflow-nodes branch from ff45b5a to c7e5eeb Compare April 21, 2026 21:10
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 7 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/nodes/Nodes.tsx Outdated
Comment thread packages/serverless-workflow-diagram-editor/src/react-flow/diagram/Diagram.css Outdated
}: RF.NodeProps<RaiseNodeType>) {
// TODO: This component is just a placeholder
return (
<div
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know this is a placeholder but since they are all the same placeholder, maybe better to just add a PlaceholderNode a the top and reference that rather than the repeated divs? Then it becomes very obvious when we are adding the real node

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

>
<RF.Handle type="target" position={RF.Position.Top} />
<div
style={{ height: height, width: width, whiteSpace: "pre-line", padding: 7 }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also maybe move inline styles to nodes css file? Again I know its a placeholder but will be good to set up that for future as we will have to do it anyway and also dont want to establish inline style pattern in case its followed when replacing the placeholder node

vi.restoreAllMocks();
});

test("render react flow custom node types", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this will need to change ti it though as its a new file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Comment thread pnpm-lock.yaml
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3
'@vitest/coverage-v8':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wondering why the lock file is updated on its own? it doesnt look like packages were updated or maybe a file wasnt checked in or else you might need to pull latest and run an install?

Copy link
Copy Markdown
Contributor Author

@handreyrc handreyrc Apr 22, 2026

Choose a reason for hiding this comment

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

@lornakelly,
I investigated a bit, deleting pnpm_lock.yaml and node_modules and then reinstalling the dependencies cause those versions to update.
Anyway I rebased again and reverted it to main versions.

@lornakelly
Copy link
Copy Markdown
Contributor

Thanks for PR @handreyrc, just added a few comments

Signed-off-by: handreyrc <handrey.cunha@gmail.com>

# Conflicts:
#	pnpm-lock.yaml
Copilot AI review requested due to automatic review settings April 22, 2026 18:56
@handreyrc handreyrc force-pushed the add-reactflow-nodes branch from d795832 to 30358cb Compare April 22, 2026 18:56
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.

height: 100%;
width: 100%;
white-space: pre;
padding: 7;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

.node-label-container sets padding: 7; without a unit, which is invalid CSS and will be ignored by the browser (so the label ends up flush with the border). Use an explicit unit (e.g., px/rem) for consistent rendering.

Suggested change
padding: 7;
padding: 7px;

Copilot uses AI. Check for mistakes.
border-radius: 5px;
background: white;
border: 1px solid #000;
transition: border ease, box-shadow ease;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

transition: border ease, box-shadow ease; omits a duration, so it effectively defaults to 0s and won't animate. Specify a duration (and ideally the specific sub-properties you want to transition) to make this rule meaningful.

Suggested change
transition: border ease, box-shadow ease;
transition: border-color 0.2s ease, box-shadow 0.2s ease;

Copilot uses AI. Check for mistakes.
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 node types and create React Flow node components

3 participants