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 751d438d68..443329a924 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -613,6 +613,7 @@ const getIterationItemType = ({ const isSystem = isSystemVar(valueSelector) const targetVar = isSystem ? beforeNodesOutputVars.find(v => v.isStartNode) : beforeNodesOutputVars.find(v => v.nodeId === outputVarNodeId) + if (!targetVar) return VarType.string @@ -623,9 +624,9 @@ const getIterationItemType = ({ arrayType = curr.find((v: any) => v.variable === (valueSelector).join('.'))?.type } else { - for (let i = 1; i < valueSelector.length - 1; i++) { + for (let i = 1; i < valueSelector.length; i++) { const key = valueSelector[i] - const isLast = i === valueSelector.length - 2 + const isLast = i === valueSelector.length - 1 curr = Array.isArray(curr) ? curr.find(v => v.variable === key) : [] if (isLast)