From 124e8d063976ea85b96aae778a4e78f6f9c30f8f Mon Sep 17 00:00:00 2001 From: zhaoying Date: Wed, 22 Apr 2026 15:33:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20var-aggregator=E2=80=98s=20variable?= =?UTF-8?q?=20delay=20calculate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Properties/hooks/useVariableList.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/src/views/Workflow/components/Properties/hooks/useVariableList.ts b/web/src/views/Workflow/components/Properties/hooks/useVariableList.ts index 14dcced2..994a0ae1 100644 --- a/web/src/views/Workflow/components/Properties/hooks/useVariableList.ts +++ b/web/src/views/Workflow/components/Properties/hooks/useVariableList.ts @@ -393,18 +393,19 @@ export const useVariableList = ( // Add chat variables chatVariables?.forEach(v => addVariable(list, keys, `CONVERSATION_${v.name}`, v.name, v.type, `conv.${v.name}`, { type: 'CONVERSATION', name: 'CONVERSATION', icon: '' }, { group: 'CONVERSATION' })); - // Process each relevant node: non-list-operator first, then list-operator - const listOperatorIds: string[] = []; + // Process each relevant node: deferred types last (they depend on prior variables) + const deferredIds: string[] = []; relevantIds.forEach(id => { const node = nodes.find(n => n.id === id); if (!node) return; - if (node.getData()?.type === 'list-operator') { - listOperatorIds.push(id); + const t = node.getData()?.type; + if (['var-aggregator', 'list-operator', 'iteration'].includes(t)) { + deferredIds.push(id); } else { processNodeVariables(node.getData(), node.getData().id, list, keys); } }); - listOperatorIds.forEach(id => { + deferredIds.forEach(id => { const node = nodes.find(n => n.id === id); if (node) processNodeVariables(node.getData(), node.getData().id, list, keys); });