diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx index 1874bcab6..6240e0ac7 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx @@ -2889,14 +2889,7 @@ const WorkflowContent = React.memo(() => { } }) }, - [ - blocks, - setDragStartPosition, - getNodes, - potentialParentId, - setPotentialParentId, - effectivePermissions.canAdmin, - ] + [blocks, setDragStartPosition, getNodes, setPotentialParentId] ) /** Handles node drag stop to establish parent-child relationships. */ diff --git a/apps/sim/stores/workflows/utils.ts b/apps/sim/stores/workflows/utils.ts index b1d3805fa..18bf38fb1 100644 --- a/apps/sim/stores/workflows/utils.ts +++ b/apps/sim/stores/workflows/utils.ts @@ -511,14 +511,15 @@ export function regenerateBlockIds( parentId: newParentId, extent: 'parent', } - } else if (existingBlockNames[oldParentId]) { - // Parent exists in existing workflow - keep original parentId (block stays in same subflow) + } else if (existingBlockNames[oldParentId] && !existingBlockNames[oldParentId].locked) { + // Parent exists in existing workflow and is not locked - keep original parentId block.data = { ...block.data, parentId: oldParentId, extent: 'parent', } } else { + // Parent doesn't exist anywhere OR parent is locked - clear the relationship // Parent doesn't exist anywhere - clear the relationship block.data = { ...block.data, parentId: undefined, extent: undefined } }