Skip to content

Commit b00a661

Browse files
fix(mothership): block subflow re-parenting in embedded workflow view
1 parent 818fa00 commit b00a661

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
@@ -3142,6 +3142,14 @@ const WorkflowContent = React.memo(
31423142
updateContainerDimensionsDuringMove(node.id, node.position)
31433143
}
31443144

3145+
// Embedded (mship panel) canvases allow repositioning but never
3146+
// re-parenting: skip container-intersection detection so a drag over a
3147+
// subflow neither highlights it nor arms potentialParentId. Both drag-stop
3148+
// paths bail when potentialParentId still equals the drag-start parent, so
3149+
// positions persist but a block can never be inserted into (or pulled out
3150+
// of) a loop/parallel from the embedded view.
3151+
if (embedded) return
3152+
31453153
// Check if this is a starter block - starter blocks should never be in containers
31463154
const isStarterBlock = node.data?.type === 'starter'
31473155
if (isStarterBlock) {
@@ -3257,6 +3265,7 @@ const WorkflowContent = React.memo(
32573265
getNodes,
32583266
potentialParentId,
32593267
blocks,
3268+
embedded,
32603269
getNodeAbsolutePosition,
32613270
getNodeDepth,
32623271
isDescendantOf,
@@ -4109,15 +4118,19 @@ const WorkflowContent = React.memo(
41094118
edgesUpdatable={!embedded && effectivePermissions.canEdit}
41104119
className={`workflow-container h-full bg-[var(--bg)] transition-opacity duration-150 ${reactFlowStyles} ${canvasOpacityClass} ${isHandMode ? 'canvas-mode-hand' : 'canvas-mode-cursor'}`}
41114120
onNodeDrag={effectivePermissions.canEdit ? onNodeDrag : undefined}
4112-
onNodeDragStop={effectivePermissions.canEdit ? onNodeDragStop : undefined}
4121+
onNodeDragStop={
4122+
!embedded && effectivePermissions.canEdit ? onNodeDragStop : undefined
4123+
}
41134124
onSelectionDragStart={
41144125
effectivePermissions.canEdit ? onSelectionDragStart : undefined
41154126
}
41164127
onSelectionDrag={effectivePermissions.canEdit ? onSelectionDrag : undefined}
41174128
onSelectionDragStop={
41184129
effectivePermissions.canEdit ? onSelectionDragStop : undefined
41194130
}
4120-
onNodeDragStart={effectivePermissions.canEdit ? onNodeDragStart : undefined}
4131+
onNodeDragStart={
4132+
!embedded && effectivePermissions.canEdit ? onNodeDragStart : undefined
4133+
}
41214134
snapToGrid={snapToGrid}
41224135
snapGrid={snapGrid}
41234136
elevateEdgesOnSelect={false}

0 commit comments

Comments
 (0)