From acf4afb1b58d6013582fbba3b010fe2ce433868d Mon Sep 17 00:00:00 2001 From: Theodore Li Date: Sat, 4 Jul 2026 15:18:44 -0700 Subject: [PATCH] fix(mothership): block subflow re-parenting in embedded workflow view (#5418) --- .../[workspaceId]/w/[workflowId]/workflow.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx index e30e9a0939..4ab924e8f3 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx @@ -3153,6 +3153,14 @@ const WorkflowContent = React.memo( updateContainerDimensionsDuringMove(node.id, node.position) } + // Embedded (mship panel) canvases allow repositioning but never + // re-parenting: skip container-intersection detection so a drag over a + // subflow neither highlights it nor arms potentialParentId. Both drag-stop + // paths bail when potentialParentId still equals the drag-start parent, so + // positions persist but a block can never be inserted into (or pulled out + // of) a loop/parallel from the embedded view. + if (embedded) return + // Check if this is a starter block - starter blocks should never be in containers const isStarterBlock = node.data?.type === 'starter' if (isStarterBlock) { @@ -3268,6 +3276,7 @@ const WorkflowContent = React.memo( getNodes, potentialParentId, blocks, + embedded, getNodeAbsolutePosition, getNodeDepth, isDescendantOf, @@ -4120,7 +4129,9 @@ const WorkflowContent = React.memo( edgesUpdatable={!embedded && effectivePermissions.canEdit} className={`workflow-container h-full bg-[var(--bg)] transition-opacity duration-150 ${reactFlowStyles} ${canvasOpacityClass} ${isHandMode ? 'canvas-mode-hand' : 'canvas-mode-cursor'}`} onNodeDrag={effectivePermissions.canEdit ? onNodeDrag : undefined} - onNodeDragStop={effectivePermissions.canEdit ? onNodeDragStop : undefined} + onNodeDragStop={ + !embedded && effectivePermissions.canEdit ? onNodeDragStop : undefined + } onSelectionDragStart={ effectivePermissions.canEdit ? onSelectionDragStart : undefined } @@ -4128,7 +4139,9 @@ const WorkflowContent = React.memo( onSelectionDragStop={ effectivePermissions.canEdit ? onSelectionDragStop : undefined } - onNodeDragStart={effectivePermissions.canEdit ? onNodeDragStart : undefined} + onNodeDragStart={ + !embedded && effectivePermissions.canEdit ? onNodeDragStart : undefined + } snapToGrid={snapToGrid} snapGrid={snapGrid} elevateEdgesOnSelect={false}