From 73856af86df1d43e0981df9f83a5b97c86c8590e Mon Sep 17 00:00:00 2001 From: waleed Date: Sat, 31 Jan 2026 18:56:57 -0800 Subject: [PATCH] fix(lock): address code review feedback - Fix toggle enabled using first toggleable block, not first block - Delete button now checks isParentLocked - Lock button now has disabled state - Editor lock icon distinguishes block vs parent lock state Co-Authored-By: Claude Opus 4.5 --- .../components/action-bar/action-bar.tsx | 11 +++++++---- .../components/panel/components/editor/editor.tsx | 12 +++++++++--- apps/sim/socket/database/operations.ts | 6 ++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx index 54659d742..d7daf5fbb 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/action-bar/action-bar.tsx @@ -225,9 +225,12 @@ export const ActionBar = memo( variant='ghost' onClick={(e) => { e.stopPropagation() - collaborativeBatchToggleLocked([blockId]) + if (!disabled) { + collaborativeBatchToggleLocked([blockId]) + } }} className={ACTION_BUTTON_STYLES} + disabled={disabled} > {isLocked ? : } @@ -319,18 +322,18 @@ export const ActionBar = memo( variant='ghost' onClick={(e) => { e.stopPropagation() - if (!disabled && !isLocked) { + if (!disabled && !isLocked && !isParentLocked) { collaborativeBatchRemoveBlocks([blockId]) } }} className={ACTION_BUTTON_STYLES} - disabled={disabled || isLocked} + disabled={disabled || isLocked || isParentLocked} > - {isLocked ? 'Block is locked' : getTooltipMessage('Delete Block')} + {isLocked || isParentLocked ? 'Block is locked' : getTooltipMessage('Delete Block')} diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx index 742e17c0c..a5b769dfd 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx @@ -368,11 +368,11 @@ export function Editor() { )}
- {/* Locked indicator - clickable to unlock if user has admin permissions */} + {/* Locked indicator - clickable to unlock if user has admin permissions and block itself is locked */} {isLocked && currentBlock && ( - {userPermissions.canAdmin ? ( + {userPermissions.canAdmin && currentBlock.locked ? (