Skip to content

Commit 6717ce8

Browse files
authored
fix(slack): remove duplicate effect that cleared subblocks on cred change (#2788)
1 parent a05003a commit 6717ce8

File tree

1 file changed

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

1 file changed

+0
-29
lines changed

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import { getDependsOnFields } from '@/blocks/utils'
3535
import { useKnowledgeBase } from '@/hooks/kb/use-knowledge'
3636
import { useMcpServers, useMcpToolsQuery } from '@/hooks/queries/mcp'
3737
import { useCredentialName } from '@/hooks/queries/oauth-credentials'
38-
import { useCollaborativeWorkflow } from '@/hooks/use-collaborative-workflow'
3938
import { useSelectorDisplayName } from '@/hooks/use-selector-display-name'
4039
import { useVariablesStore } from '@/stores/panel'
4140
import { 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

Comments
 (0)