From 195ac19774a6bb1996a17f53ba5dacad74811206 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 25 Sep 2024 13:41:56 +0800 Subject: [PATCH] chore: list filter transfer value to array --- .../nodes/list-filter/components/filter-condition.tsx | 11 ++++++----- .../components/workflow/nodes/list-filter/types.ts | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/web/app/components/workflow/nodes/list-filter/components/filter-condition.tsx b/web/app/components/workflow/nodes/list-filter/components/filter-condition.tsx index 4421b73a12..f8c1043761 100644 --- a/web/app/components/workflow/nodes/list-filter/components/filter-condition.tsx +++ b/web/app/components/workflow/nodes/list-filter/components/filter-condition.tsx @@ -30,6 +30,7 @@ const FilterCondition: FC = ({ }) => { const { t } = useTranslation() const isSelect = [ComparisonOperator.in, ComparisonOperator.notIn, ComparisonOperator.allOf].includes(condition.comparison_operator) + const isTransferMethod = condition.key === 'transfer_method' const selectOptions = useMemo(() => { if (isSelect) { if (condition.key === 'type' || condition.comparison_operator === ComparisonOperator.allOf) { @@ -38,7 +39,7 @@ const FilterCondition: FC = ({ value: item.value, })) } - if (condition.key === 'transfer_method') { + if (isTransferMethod) { return TRANSFER_METHOD.map(item => ({ name: t(`${optionNameI18NPrefix}.${item.i18nKey}`), value: item.value, @@ -47,15 +48,15 @@ const FilterCondition: FC = ({ return [] } return [] - }, [condition.comparison_operator, condition.key, isSelect, t]) + }, [condition.comparison_operator, condition.key, isSelect, t, isTransferMethod]) const handleChange = useCallback((key: string) => { return (value: any) => { onChange({ ...condition, - [key]: value, + [key]: isTransferMethod ? [value] : value, }) } - }, [condition, onChange]) + }, [condition, onChange, isTransferMethod]) const handleSubVariableChange = useCallback((value: string) => { onChange({ @@ -88,7 +89,7 @@ const FilterCondition: FC = ({ {isSelect && (