Skip to content

armgit / dify

Public Imported from GitHub
0

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.

fix(variables): Improve `getNodeUsedVars` implementation details (#21987)

Minamiyama71385d594dee
diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
index 7bd78ec6b66..1058f29119d 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts
@@ -975,6 +975,7 @@ 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 || []))
break
}
case BlockEnum.Code: {
@@ -994,6 +995,9 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
res = [payload.query_variable_selector]
const varInInstructions = matchNotSystemVars([payload.instruction || ''])
res.push(...varInInstructions)
+
+ const classes = payload.classes.map(c => c.name)
+ res.push(...matchNotSystemVars(classes))
break
}
case BlockEnum.HttpRequest: {