Skip to content

fix(workflow): hide idle nested subflow end handles - #6976

Open
BillLeoutsakosvl346 wants to merge 3 commits into
stagingfrom
fix/nested-subflow-handle-visibility
Open

fix(workflow): hide idle nested subflow end handles#6976
BillLeoutsakosvl346 wants to merge 3 commits into
stagingfrom
fix/nested-subflow-handle-visibility

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Hide the fixed right end port for nested Loop and Parallel containers when no displayed edge uses the canonical end handle.
  • Keep the semantic React Flow end handle mounted and preserve cursor-swell authoring, saved handle IDs, and edge topology.
  • Remove the rejected 98px Start-lane constraint so nested blocks and containers again use the existing 24px left gutter and can move left when vertically clear.
  • Render every persisted edge entering a Loop or Parallel on the target container layer. React Flow paints the equal-z target afterward, so the target covers the incoming segment while the edge remains above its parent container.
  • Apply the same target-aware layering in the editor, execution/application preview, and flattened docs renderer. Selected-edge controls follow the target occlusion layer; in-flight connection lines remain elevated.

Eng Todo: https://sim-ai.slack.com/archives/C093DF8MA21/p1786560718145569

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Compatibility

  • Existing and new layouts keep the pre-existing container positioning behavior; no workflow positions are migrated or rewritten.
  • Persisted schemas, extent values, edge IDs, serialization, validation, auto-layout, execution topology, and handle normalization are unchanged.
  • Highlight and execution state still change edge styling, but cannot lift an incoming edge over its Loop or Parallel target.
  • Covered edge segments intentionally yield pointer interaction to the target; visible segments remain above the parent body and interactive.

Testing

Automated:

  • Workflow renderer focused suites: 49 tests passed across canvas layering, edge rendering, and Loop/Parallel handle rendering.
  • Sim positioning and node-utility suites: 8 tests passed.
  • Docs workflow transformation suite: 2 tests passed.
  • bun run --cwd packages/workflow-renderer lint:check
  • bun run --cwd packages/workflow-renderer type-check
  • bun run --cwd apps/sim type-check
  • bun run --cwd apps/docs type-check
  • bun run check:api-validation
  • git diff --check

Manual local-app verification:

  • Moved the nested Parallel down and left to the normal relative X 24 gutter; it no longer snaps to X 98.
  • Confirmed the incoming nested edge renders at z=1 above the parent Loop at z=0 and beneath the Parallel at z=1.
  • Confirmed the low-left route remains visible over the Loop body and stops visually at the Parallel boundary without crossing its title.
  • Returned the Parallel to the overlapping Start-pill case and confirmed the covered line segment disappears beneath the Parallel instead of remaining visible across its title.
  • Retained the prior verification that idle nested end ports are absent, canonical handles remain mounted, cursor-swell creation works, and connected canonical end ports remain visible.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Not attached; the manual geometry and layer verification results are listed above.

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 23, 2026 8:07pm

Request Review

@BillLeoutsakosvl346
BillLeoutsakosvl346 force-pushed the fix/nested-subflow-handle-visibility branch from f069838 to 6d0de5c Compare August 22, 2026 19:51
@BillLeoutsakosvl346
BillLeoutsakosvl346 marked this pull request as ready for review August 22, 2026 19:51
@BillLeoutsakosvl346
BillLeoutsakosvl346 requested a review from a team as a code owner August 22, 2026 19:51
@cursor

cursor Bot commented Aug 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches React Flow z-order and subflow handle painting across editor, preview, and docs. Wrong layering or handle visibility can hide connections or break nested-container UX, but schemas and execution topology are unchanged.

Overview
Fixes nested Loop/Parallel chrome: idle nested containers no longer paint the fixed right end port, while the semantic React Flow handle stays mounted. Top-level containers and nested ones that already have a canonical end-handle edge still show the knob.

Incoming edges that target a Loop/Parallel now share that container’s z-layer via getEdgeZIndexForTarget, so React Flow paints the target over the last segment while the line stays above the parent body. Highlight/execution z no longer lifts those edges over the target. The same rule is applied in the editor, execution preview, and flattened docs renderer; selected-edge delete controls follow labelZIndex when the target is a container.

Docs preview nodes now carry parentId and nesting-based z-index. Adds renderer, docs, and mount tests (including no extra nested-subflow rerenders on unrelated edge changes) and a vitest script in apps/docs.

Reviewed by Cursor Bugbot for commit b71ba64. Configure here.

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author
Screen.Recording.2026-08-22.at.12.32.30.PM.mov

@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR hides unused visual end ports on nested Loop and Parallel containers while retaining their semantic handles, and aligns incoming-edge occlusion across editor and preview renderers.

  • Adds target-aware edge z-index resolution for container targets.
  • Propagates nesting metadata through Sim and docs previews.
  • Adds focused tests for handle visibility, layering, and selected-edge controls.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/workflow-renderer/src/subflow/subflow-node-view.tsx Conditionally includes the fixed visual end port for nested subflows while leaving the semantic React Flow handle mounted.
packages/workflow-renderer/src/canvas-layers.ts Adds shared target-aware edge layering so incoming segments are occluded by their container target.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx Applies target-aware layering to editor edges and their selected-edge controls.
apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx Applies container-target occlusion consistently in execution and application previews.
apps/docs/components/workflow-preview/workflow-data.ts Computes semantic nesting depth for flattened docs nodes and applies corresponding node and edge layers.

Reviews (3): Last reviewed commit: "perf(workflow): stabilize subflow edge s..." | Re-trigger Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

Comment thread packages/workflow-renderer/src/subflow/subflow-node-view.tsx Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ 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 b71ba64. Configure here.

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.

2 participants