File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments