feat(studio): visualize loop/parallel/try_catch nested regions on the flow canvas (#2670 Phase 1)#2675
Merged
Conversation
… flow canvas (#2670) Phase 1 of #2670 (ADR-0031 designer rendering follow-up to the Runs-panel nesting in #2667). The flow designer rendered `loop`/`parallel`/`try_catch` containers as opaque single cards; their nested regions (`config.body` / `config.branches[]` / `config.try`/`catch`) were only visible as raw JSON. - `extractRegions(node)` (flow-canvas-layout) — pure: pulls a container's labeled regions from config; returns [] for ordinary nodes and legacy flat loops. - `flow-region-view` — read-only mini-canvas for a region, reusing `computeLayout` / `diagramSize` / `edgePath` at full scale then fitting to width with one CSS transform (no new layout engine). - `NodeCard` — a container gains a "show nested regions" control that opens the region(s) in a Popover, each with a header (named branch / `Branch N` / `Try` / `Catch`). Floating + portaled, so it never overlaps canvas nodes and needs no change to the layout or edge routing — zero regression to existing flows. Read-only for now; inline push-down nesting and nested editing are the next increments on #2670. Adds `extractRegions` unit tests and FlowCanvas render tests (loop body, parallel branch labels, legacy-loop has no control). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VuvxWgoadqryqBcjs7TpVi
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
marked this pull request as ready for review
July 19, 2026 11:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 1 of #2670 — the ADR-0031 "designer rendering" follow-up to the Runs-panel nesting (#2667). The flow designer canvas rendered structured control-flow containers (
loop/parallel/try_catch) as opaque single node cards; their nested regions (config.body/config.branches[]/config.try/catch) were only visible — and only editable — as raw JSON in the inspector's Advanced block.A container card now carries a "show nested regions" control that opens a read-only popover rendering the region(s) as a mini-canvas — the same top-to-bottom node/edge layout as the parent graph — so an author can see the structure without reading JSON.
What changed
flow-canvas-layout.ts—extractRegions(node)(pure): pulls a container's labeled regions fromconfig. Returns[]for ordinary nodes and for a legacy flatloop(noconfig.body), which stay plain cards.flow-region-view.tsx(new) — a read-only mini-canvas for a region: reuses the sharedcomputeLayout/diagramSize/edgePathat full scale, then fits the whole region to the popover width with a single CSS transform. No new layout engine.flow-canvas-parts.tsx(NodeCard) — when a node has regions, a chevron control opens aPopoverwith the region view, each region headed by its label (a named branch orBranch N, andTry/Catch; a loop body has none).FlowCanvas.tsx— passesextractRegions(node)to each card.Design note — why a popover (zero regression)
The region renders in a floating, portaled Popover, so it never overlaps the canvas's other nodes and requires no change to
computeLayout,diagramSize, or the edge routing — every existing flat flow renders byte-identically. (An earlier inline-growth prototype overlapped the nodes below an expanded container; push-down layout would mean threading variable heights through the shared layout + edge anchors — deferred deliberately.)Deferred to the next increments on #2670: inline push-down nesting on the canvas (regions embedded in the flow, siblings pushed down), nested selection + a structured region inspector, nested editing (add/drag/reparent), and client-side region validation. This PR does not close #2670.
Verification
flow-canvas-layout.test.ts—extractRegionsunit tests (ordinary / legacy-loop / loop body / parallel-branch labels / try+catch).FlowCanvas.test.tsx— render tests: opening a loop shows its body node; parallel branch labels (Branch 2) + handlers render; a legacy flat loop has no region control.turbo type-checkclean; ESLint 0 errors.🤖 Generated with Claude Code
Generated by Claude Code