feat(workflow-renderer): extract pure WorkflowBlockView + SubBlockRowView#5267
Conversation
…s summary row Splits the canvas block's collapsed subblock summary row into a pure SubBlockRowView (title + resolved displayValue + monospace flag) in @sim/workflow-renderer. The ~9 selector-name hydration hooks stay in the SubBlockRow container behind its memo comparator; the view receives only resolved strings. Byte-identical row JSX. First step toward the full WorkflowBlockView.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@greptile |
PR SummaryMedium Risk Overview
Exports are added from Reviewed by Cursor Bugbot for commit 2b56e82. Configure here. |
|
@cursor review |
Moves the canvas block's render (header, badges, dynamic handles, ring) into a pure WorkflowBlockView in @sim/workflow-renderer. WorkflowBlock becomes a thin container that resolves all stores/hooks/permissions, builds the subblock rows + actionBar slots, and binds wouldCreateConnectionCycle (reads the edge store fresh per call to preserve cycle prevention). getHandleClasses/getHandleStyle move into the view; config.icon/bgColor, the webhook provider name, and every visual flag cross as props. Byte-identical JSX — every handle id/class/style/offset and badge guard preserved (verified by an independent adversarial audit). Container drops from 1137 to 829 lines.
16ba04e to
2b56e82
Compare
Greptile SummaryThis PR extracts the workflow canvas block node into two pure, props-driven view components —
Confidence Score: 2/5Not safe to merge — the cycle-prevention guard on every workflow edge handle is now inverted, allowing connections that form cycles and blocking valid ones. The double-negation in workflow-block.tsx lines 697–698: the definition of Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant RF as ReactFlow
participant WBV as WorkflowBlockView
participant WB as WorkflowBlock (container)
participant Store as useWorkflowStore
RF->>WBV: isValidConnection(connection)
WBV->>WBV: "if connection.source/target === id → false"
WBV->>WB: wouldCreateConnectionCycle(source, target)
WB->>Store: getState().edges
Store-->>WB: edges[]
WB->>WB: !wouldCreateCycle(edges, source, target)
Note over WB: BUG: returns true when NO cycle exists
WB-->>WBV: bool (inverted)
WBV->>WBV: !wouldCreateConnectionCycle(...)
Note over WBV: double-negation → accepts cycles
WBV-->>RF: bool (inverted result)
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant RF as ReactFlow
participant WBV as WorkflowBlockView
participant WB as WorkflowBlock (container)
participant Store as useWorkflowStore
RF->>WBV: isValidConnection(connection)
WBV->>WBV: "if connection.source/target === id → false"
WBV->>WB: wouldCreateConnectionCycle(source, target)
WB->>Store: getState().edges
Store-->>WB: edges[]
WB->>WB: !wouldCreateCycle(edges, source, target)
Note over WB: BUG: returns true when NO cycle exists
WB-->>WBV: bool (inverted)
WBV->>WBV: !wouldCreateConnectionCycle(...)
Note over WBV: double-negation → accepts cycles
WBV-->>RF: bool (inverted result)
Reviews (2): Last reviewed commit: "feat(workflow-renderer): extract pure Wo..." | Re-trigger Greptile |
|
@cursor review |
|
@greptile |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2b56e82. Configure here.
|
@greptile re-review — the cycle-prevention double-negation was fixed in the current HEAD ( |
Summary
Completes the workflow renderer by extracting the canvas block node — the most complex one — into pure, props-driven Views in
@sim/workflow-renderer, matching the edge/subflow/note pattern from #5263.SubBlockRowView— the collapsed block's subblock summary row ({ title, displayValue?, isMonospace? }). The ~9 selector-name hydration hooks (credentials, knowledge bases, tables, MCP servers/tools, sub-workflows, skills, variables) stay in the row container behind its memo comparator; the view receives only resolved strings.WorkflowBlockView— the block shell (header, icon, all badges, dynamic condition/router/error handles, ring). The editor node becomes a thin container that resolves stores/hooks/permissions, builds the subblockrows+actionBarslots, and bindswouldCreateConnectionCycle(reads the edge store fresh per call, preserving cycle-prevention for collaborators).config.icon/bgColor, the webhook provider name, and every visual flag cross as props. Container drops 1137 → 829 lines.Visual output and behavior are unchanged — verified by an independent adversarial byte-identical audit (every handle
id/class/style/offset, all four badges with their guards,isValidConnectionpolarity, and the ring all confirmed identical).Type of Change
Testing
apps/sim+@sim/workflow-renderertypecheck 0 errors; monorepo boundaries + biome clean. The View imports onlyreact/@sim/emcn/reactflow/../dimensions/../types— nothing app-coupled.Checklist