feat(ui): install @xyflow/react and scaffold WorkflowCanvas base component#1107
feat(ui): install @xyflow/react and scaffold WorkflowCanvas base component#1107geoffjay wants to merge 2 commits into
Conversation
|
This change is part of the following stack:
Change managed by git-spice. |
geoffjay
left a comment
There was a problem hiding this comment.
Review: feat(ui): install @xyflow/react and scaffold WorkflowCanvas base component
Stack position: Base of the UI canvas stack — stacked directly on feature/autonomous-pipeline. No parent PRs to review first.
Overview
Installs @xyflow/react@12.10.2 and scaffolds the WorkflowCanvas component that wraps React Flow with Controls, MiniMap, and Background. The canvas accepts nodeTypes/edgeTypes registries as optional props so children in the stack can extend it without modifying this file.
What looks good
- Theme token wiring: React Flow's CSS variables (
--xy-background-color,--xy-edge-stroke, etc.) are mapped to the project's--th-*tokens inline. This ensures the canvas inherits both light and dark mode correctly without duplicating theme logic. - Provider pattern: The outer
WorkflowCanvaswrapsCanvasinReactFlowProvider. The comment correctly explains the trade-offs for multi-canvas pages. snapToGrid={true}withsnapGrid={[16, 16]}: Sensible default for a workflow builder. This keeps node placement tidy and consistent.- Optional
nodeTypes/edgeTypesprops: Correct extensibility design — callers pass their type registries; this base component doesn't need to know about them. - Smoke tests: 4 tests cover: no-throw, wrapper testid, className forwarding, and render with non-empty nodes/edges. Appropriate for a scaffold component.
Non-blocking note
The inline style map requires a biome-ignore lint/suspicious/noExplicitAny comment to suppress the TypeScript error from assigning to CSS custom properties. This is the standard workaround and is correctly annotated. An alternative would be style={{ ...cssVarMap } as React.CSSProperties} where cssVarMap is typed as Record<string, string>, but what's here is readable and correct.
Verdict
Clean scaffold with good extensibility design. LGTM.
…onent - Add @xyflow/react v12 dependency - Create WorkflowCanvas with Controls, MiniMap, and Background - Map agentd theme tokens to React Flow CSS variables - Enable snapToGrid (16px) and fitView defaults - Wrap canvas in ReactFlowProvider - Export from workflows barrel index - Add tests for basic rendering
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1107 +/- ##
==========================================
+ Coverage 63.77% 63.79% +0.01%
==========================================
Files 173 174 +1
Lines 7733 7739 +6
Branches 2566 2567 +1
==========================================
+ Hits 4932 4937 +5
- Misses 2780 2781 +1
Partials 21 21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Install React Flow v12 and create the foundational WorkflowCanvas component with Controls, MiniMap, Background, theme token mapping, and snapToGrid defaults.
Closes #1095