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#18595: update workflow duplicate env variable name (#18596)

onlysyzcf464d252dfc
diff --git a/web/app/components/workflow/panel/env-panel/variable-modal.tsx b/web/app/components/workflow/panel/env-panel/variable-modal.tsx
index f7dfbad8928..4546aabae69 100644
--- a/web/app/components/workflow/panel/env-panel/variable-modal.tsx
+++ b/web/app/components/workflow/panel/env-panel/variable-modal.tsx
@@ -47,8 +47,14 @@ const VariableModal = ({
return
if (!value)
return notify({ type: 'error', message: 'value can not be empty' })
- if (!env && envList.some(env => env.name === name))
+
+ // Add check for duplicate name when editing
+ if (env && env.name !== name && envList.some(e => e.name === name))
+ return notify({ type: 'error', message: 'name is existed' })
+ // Original check for create new variable
+ if (!env && envList.some(e => e.name === name))
return notify({ type: 'error', message: 'name is existed' })
+
onSave({
id: env ? env.id : uuid4(),
value_type: type,