|
|
|
@@ -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, new |
|
|
|
return 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: { |