fix(workflow): show Remove from Subflow for unconnected blocks pasted into subflows#4971
Conversation
… into subflows A block copy-pasted into a loop/parallel has parentId set but no incoming edges yet, so the context menu's positional-trigger heuristic (no incoming edges = trigger) classified it as a trigger and hid Remove from Subflow. Blocks nested inside a subflow can never be entry points, so they are now excluded from positional-trigger classification.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Introduces Reviewed by Cursor Bugbot for commit e8a8cd3. Configure here. |
|
@greptile |
|
@cursor review |
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 e8a8cd3. Configure here.
Greptile SummaryThis PR fixes a bug where the "Remove from Subflow" context menu option was hidden for blocks that were copy-pasted into a loop or parallel subflow. Pasted blocks have
Confidence Score: 5/5Safe to merge — the change is a well-scoped extraction of an existing inline expression into a named, tested helper with a clear correctness invariant. The fix is minimal and focused: one new pure helper, one call-site substitution, and six unit tests including a regression case. The parentId guard is the correct property to check — it is set synchronously when a block is pasted into a subflow, before any edges are created, which is exactly the scenario that was broken. No existing behavior is altered for top-level blocks, and the BlockInfo type already carries parentId, so the type contract is satisfied at the call site. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Right-click block in canvas] --> B{contextMenuBlocks.length === 1?}
B -- No --> C[isPositionalTrigger = false]
B -- Yes --> D[isPositionalTriggerBlock called with block + edges]
D --> E{block defined?}
E -- No --> F[return false]
E -- Yes --> G{block.parentId set?}
G -- Yes: nested in subflow --> H[return false — never a trigger]
G -- No: top-level --> I{any edge targets this block?}
I -- Yes --> J[return false — has incoming connection]
I -- No --> K[return true — positional trigger]
H --> L{Show Remove from Subflow?}
J --> L
K --> L
C --> L
L -- isPositionalTrigger=true --> M[Hide Remove from Subflow]
L -- isPositionalTrigger=false --> N[Show Remove from Subflow if parentId is set]
Reviews (2): Last reviewed commit: "fix(workflow): show Remove from Subflow ..." | Re-trigger Greptile |
Summary
parentIdset but no incoming edges yet, so the context menu's positional-trigger heuristic (no incoming edges = trigger) misclassified them as triggers and hid "Remove from Subflow"isPositionalTriggerBlockhelper — blocks nested inside a subflow are never classified as positional triggers regardless of edgesparentId), which is why it showed the button while the right-click menu didn'tType of Change
Testing
Added unit tests for the helper, including a regression case for a pasted, unconnected block inside a loop. All canvas utils tests pass; typecheck clean.
Checklist