Skip to content

Commit b7d0f20

Browse files
committed
Fix ops bug
1 parent 1f6f58c commit b7d0f20

File tree

1 file changed

+8
-3
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,15 @@ export const WorkflowBlock = memo(function WorkflowBlock({
631631
? ((credValue as { value?: unknown }).value as string | undefined)
632632
: (credValue as string | undefined)
633633
if (prevCredRef.current !== cred) {
634+
// Only clear dependent fields when credential changes from one value to another,
635+
// not when it's being set for the first time (e.g., during copilot block creation)
636+
const hadPreviousCredential = prevCredRef.current !== undefined
634637
prevCredRef.current = cred
635-
const keys = Object.keys(current)
636-
const dependentKeys = keys.filter((k) => k !== 'credential')
637-
dependentKeys.forEach((k) => collaborativeSetSubblockValue(id, k, ''))
638+
if (hadPreviousCredential) {
639+
const keys = Object.keys(current)
640+
const dependentKeys = keys.filter((k) => k !== 'credential')
641+
dependentKeys.forEach((k) => collaborativeSetSubblockValue(id, k, ''))
642+
}
638643
}
639644
}, [id, collaborativeSetSubblockValue])
640645

0 commit comments

Comments
 (0)