fix(lock): fix toggle locked target state and draggable check

1. BATCH_TOGGLE_LOCKED now uses first block from blocksToToggle set
   instead of blockIds[0], matching BATCH_TOGGLE_ENABLED pattern.
   Also added early exit if blocksToToggle is empty.

2. Blocks inside locked containers are now properly non-draggable.
   Changed draggable check from !block.locked to use isBlockProtected()
   which checks both block lock and parent container lock.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
waleed
2026-01-31 20:29:14 -08:00
parent 0eea69b07d
commit 395e6ed591
2 changed files with 6 additions and 4 deletions

View File

@@ -2156,7 +2156,7 @@ const WorkflowContent = React.memo(() => {
parentId: block.data?.parentId,
extent: block.data?.extent || undefined,
dragHandle: '.workflow-drag-handle',
draggable: !block.locked,
draggable: !isBlockProtected(block.id, blocks),
data: {
...block.data,
name: block.name,
@@ -2192,7 +2192,7 @@ const WorkflowContent = React.memo(() => {
position,
parentId: block.data?.parentId,
dragHandle,
draggable: !block.locked,
draggable: !isBlockProtected(block.id, blocks),
extent: (() => {
// Clamp children to subflow body (exclude header)
const parentId = block.data?.parentId as string | undefined

View File

@@ -870,8 +870,10 @@ async function handleBlocksOperationTx(
}
}
// Determine target locked state based on first block
const firstBlock = blocksById[blockIds[0]]
// Determine target locked state based on first toggleable block
if (blocksToToggle.size === 0) break
const firstToggleableId = Array.from(blocksToToggle)[0]
const firstBlock = blocksById[firstToggleableId]
if (!firstBlock) break
const targetLocked = !firstBlock.locked