@@ -35,7 +35,6 @@ import { getDependsOnFields } from '@/blocks/utils'
3535import { useKnowledgeBase } from '@/hooks/kb/use-knowledge'
3636import { useMcpServers , useMcpToolsQuery } from '@/hooks/queries/mcp'
3737import { useCredentialName } from '@/hooks/queries/oauth-credentials'
38- import { useCollaborativeWorkflow } from '@/hooks/use-collaborative-workflow'
3938import { useSelectorDisplayName } from '@/hooks/use-selector-display-name'
4039import { useVariablesStore } from '@/stores/panel'
4140import { useWorkflowRegistry } from '@/stores/workflows/registry/store'
@@ -613,34 +612,6 @@ export const WorkflowBlock = memo(function WorkflowBlock({
613612 [ isDeploying , setDeploymentStatus , refetchDeployment ]
614613 )
615614
616- const { collaborativeSetSubblockValue } = useCollaborativeWorkflow ( )
617-
618- /**
619- * Clear credential-dependent fields when credential changes to prevent
620- * stale data from persisting with new credentials.
621- */
622- const prevCredRef = useRef < string | undefined > ( undefined )
623- useEffect ( ( ) => {
624- const activeWorkflowId = useWorkflowRegistry . getState ( ) . activeWorkflowId
625- if ( ! activeWorkflowId ) return
626- const current = useSubBlockStore . getState ( ) . workflowValues [ activeWorkflowId ] ?. [ id ]
627- if ( ! current ) return
628- const credValue = current . credential
629- const cred =
630- typeof credValue === 'object' && credValue !== null && 'value' in credValue
631- ? ( ( credValue as { value ?: unknown } ) . value as string | undefined )
632- : ( credValue as string | undefined )
633- if ( prevCredRef . current !== cred ) {
634- const hadPreviousCredential = prevCredRef . current !== undefined
635- prevCredRef . current = cred
636- if ( hadPreviousCredential ) {
637- const keys = Object . keys ( current )
638- const dependentKeys = keys . filter ( ( k ) => k !== 'credential' )
639- dependentKeys . forEach ( ( k ) => collaborativeSetSubblockValue ( id , k , '' ) )
640- }
641- }
642- } , [ id , collaborativeSetSubblockValue ] )
643-
644615 const currentStoreBlock = currentWorkflow . getBlockById ( id )
645616
646617 const isStarterBlock = type === 'starter'
0 commit comments