Skip to content

Commit

Permalink
fix: input vars not auto rename in list operator (langgenius#9550)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjoel authored Oct 21, 2024
1 parent f83ed19 commit 65e22bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,11 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
res = [(data as IterationNodeType).iterator_selector]
break
}

case BlockEnum.ListFilter: {
res = [(data as ListFilterNodeType).variable]
break
}
}
return res || []
}
Expand Down Expand Up @@ -997,6 +1002,12 @@ export const updateNodeVars = (oldNode: Node, oldVarSelector: ValueSelector, new

break
}
case BlockEnum.ListFilter: {
const payload = data as ListFilterNodeType
if (payload.variable.join('.') === oldVarSelector.join('.'))
payload.variable = newVarSelector
break
}
}
})
return newNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const useConfig = (id: string, payload: ListFilterNodeType) => {
const itemVarTypeShowName = useMemo(() => {
if (!inputs.variable)
return '?'
return [itemVarType.substring(0, 1).toUpperCase(), itemVarType.substring(1)].join('')
return [(itemVarType || VarType.string).substring(0, 1).toUpperCase(), (itemVarType || VarType.string).substring(1)].join('')
}, [inputs.variable, itemVarType])

const hasSubVariable = [VarType.arrayFile].includes(varType)
Expand Down

0 comments on commit 65e22bb

Please sign in to comment.