Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(workflow/if-else): keep conditions in sync on variable rename (#23611)
Rajhans Jadhao8d472135294a
diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.tsindex a6435ec632e..387567da0a9 100644--- a/web/app/components/workflow/hooks/use-workflow.ts+++ b/web/app/components/workflow/hooks/use-workflow.ts@@ -259,11 +259,11 @@ export const useWorkflow = () => {const handleOutVarRenameChange = useCallback((nodeId: string, oldValeSelector: ValueSelector, newVarSelector: ValueSelector) => {const { getNodes, setNodes } = store.getState()- const afterNodes = getAfterNodesInSameBranch(nodeId)- const effectNodes = findUsedVarNodes(oldValeSelector, afterNodes)- if (effectNodes.length > 0) {- const newNodes = getNodes().map((node) => {- if (effectNodes.find(n => n.id === node.id))+ const allNodes = getNodes()+ const affectedNodes = findUsedVarNodes(oldValeSelector, allNodes)+ if (affectedNodes.length > 0) {+ const newNodes = allNodes.map((node) => {+ if (affectedNodes.find(n => n.id === node.id))return updateNodeVars(node, oldValeSelector, newVarSelector)return nodediff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.tsindex 8c3ffb88103..ac9432f69e5 100644--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts@@ -1022,7 +1022,15 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {res = (data as IfElseNodeType).conditions?.map((c) => {return c.variable_selector || []}) || []- res.push(...((data as IfElseNodeType).cases || []).flatMap(c => (c.conditions || [])).map(c => c.variable_selector || []))+ res.push(...((data as IfElseNodeType).cases || []).flatMap(c => (c.conditions || [])).flatMap((c) => {+ const selectors: ValueSelector[] = []+ if (c.variable_selector)+ selectors.push(c.variable_selector)+ // Handle sub-variable conditions+ if (c.sub_variable_condition && c.sub_variable_condition.conditions)+ selectors.push(...c.sub_variable_condition.conditions.map(subC => subC.variable_selector || []).filter(sel => sel.length > 0))+ return selectors+ }))break}case BlockEnum.Code: {@@ -1259,6 +1267,26 @@ export const updateNodeVars = (oldNode: Node, oldVarSelector: ValueSelector, newreturn c})}+ if (payload.cases) {+ payload.cases = payload.cases.map((caseItem) => {+ if (caseItem.conditions) {+ caseItem.conditions = caseItem.conditions.map((c) => {+ if (c.variable_selector?.join('.') === oldVarSelector.join('.'))+ c.variable_selector = newVarSelector+ // Handle sub-variable conditions+ if (c.sub_variable_condition && c.sub_variable_condition.conditions) {+ c.sub_variable_condition.conditions = c.sub_variable_condition.conditions.map((subC) => {+ if (subC.variable_selector?.join('.') === oldVarSelector.join('.'))+ subC.variable_selector = newVarSelector+ return subC+ })+ }+ return c+ })+ }+ return caseItem+ })+ }break}case BlockEnum.Code: {