Skip to content

Commit acf4afb

Browse files
fix(mothership): block subflow re-parenting in embedded workflow view (#5418)
1 parent 82eff54 commit acf4afb

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,14 @@ const WorkflowContent = React.memo(
31533153
updateContainerDimensionsDuringMove(node.id, node.position)
31543154
}
31553155

3156+
// Embedded (mship panel) canvases allow repositioning but never
3157+
// re-parenting: skip container-intersection detection so a drag over a
3158+
// subflow neither highlights it nor arms potentialParentId. Both drag-stop
3159+
// paths bail when potentialParentId still equals the drag-start parent, so
3160+
// positions persist but a block can never be inserted into (or pulled out
3161+
// of) a loop/parallel from the embedded view.
3162+
if (embedded) return
3163+
31563164
// Check if this is a starter block - starter blocks should never be in containers
31573165
const isStarterBlock = node.data?.type === 'starter'
31583166
if (isStarterBlock) {
@@ -3268,6 +3276,7 @@ const WorkflowContent = React.memo(
32683276
getNodes,
32693277
potentialParentId,
32703278
blocks,
3279+
embedded,
32713280
getNodeAbsolutePosition,
32723281
getNodeDepth,
32733282
isDescendantOf,
@@ -4120,15 +4129,19 @@ const WorkflowContent = React.memo(
41204129
edgesUpdatable={!embedded && effectivePermissions.canEdit}
41214130
className={`workflow-container h-full bg-[var(--bg)] transition-opacity duration-150 ${reactFlowStyles} ${canvasOpacityClass} ${isHandMode ? 'canvas-mode-hand' : 'canvas-mode-cursor'}`}
41224131
onNodeDrag={effectivePermissions.canEdit ? onNodeDrag : undefined}
4123-
onNodeDragStop={effectivePermissions.canEdit ? onNodeDragStop : undefined}
4132+
onNodeDragStop={
4133+
!embedded && effectivePermissions.canEdit ? onNodeDragStop : undefined
4134+
}
41244135
onSelectionDragStart={
41254136
effectivePermissions.canEdit ? onSelectionDragStart : undefined
41264137
}
41274138
onSelectionDrag={effectivePermissions.canEdit ? onSelectionDrag : undefined}
41284139
onSelectionDragStop={
41294140
effectivePermissions.canEdit ? onSelectionDragStop : undefined
41304141
}
4131-
onNodeDragStart={effectivePermissions.canEdit ? onNodeDragStart : undefined}
4142+
onNodeDragStart={
4143+
!embedded && effectivePermissions.canEdit ? onNodeDragStart : undefined
4144+
}
41324145
snapToGrid={snapToGrid}
41334146
snapGrid={snapGrid}
41344147
elevateEdgesOnSelect={false}

0 commit comments

Comments
 (0)