Add node containment support to composite tasks react flow components (do, for, fork, try) #159
Add node containment support to composite tasks react flow components (do, for, fork, try) #159handreyrc wants to merge 6 commits into
Conversation
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
✅ Deploy Preview for swf-editor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds containment (parent/child) support in the React Flow diagram and integrates it with the ELK auto-layout pipeline, including new node types, layout options for parent nodes, edge nesting at lowest common ancestor, and accompanying tests.
Changes:
- Render child nodes with
parentId/extent: "parent"; build ELK graph hierarchically and place edges at the lowest common ancestor; introducePARENT_LAYOUT_OPTIONS. - Add
EntryNodeandExitNodeplaceholder components and register them inReactFlowNodeTypes. - Expand unit tests and update e2e expected node/edge counts.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/react-flow/diagram/diagramBuilder.ts | Emit all nodes (not only root) and set parentId/extent for child nodes. |
| src/react-flow/diagram/autoLayout.ts | New parent layout options, nested ELK graph construction, LCA-based edge nesting, and edge waypoint handling for nested edges. |
| src/react-flow/nodes/Nodes.tsx | Register Entry/Exit node types and add placeholder components. |
| tests/react-flow/diagram/diagramBuilder.test.ts | New tests for edge animation, parent/child relations, catch containers, task data, and graph structure. |
| tests/react-flow/diagram/autoLayout.integration.test.ts | New tests for hierarchy/edge placement, waypoint handling, abort signal, error rejection, and updated layout option assertions. |
| tests-e2e/diagram-editor.spec.ts | Update expected node/edge counts to reflect containment-rendered children. |
| .changeset/containment-auto-layout.md | Add changeset entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
fantonangeli
left a comment
There was a problem hiding this comment.
Thanks @handreyrc, just 2 small suggestions
| const reactFlowNodeMap = new Map(reactFlowGraph.nodes.map((node) => [node.id, node])); | ||
|
|
||
| // Helper function to find the common ancestor of two nodes | ||
| const findCommonAncestor = (sourceId: string, targetId: string): string => { |
There was a problem hiding this comment.
This looks like an helper function which can be declared at top level in this file, receiving reactFlowNodeMap as input
| }); | ||
|
|
||
| // Clean up empty edges arrays from nodes that don't need them | ||
| const cleanupEmptyEdges = (node: ElkNode) => { |
There was a problem hiding this comment.
I would also declare this as top level function
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Signed-off-by: handreyrc <handrey.cunha@gmail.com>
Closes #80
Closes #81
Closes #82
Summary
This PR enable containment support to tasks containing child tasks integrated with the auto-layout engine.
Changes