From 9c4f1a8d7f277a63006dec9f74a449e056ad067b Mon Sep 17 00:00:00 2001 From: black Date: Fri, 21 Apr 2023 11:04:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20filter-condition-update-incorrectly(swit?= =?UTF-8?q?ch=20"and"=E3=80=81"or")=20(#1737)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/src/schema-component/antd/filter/useValues.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/filter/useValues.ts b/packages/core/client/src/schema-component/antd/filter/useValues.ts index 44533a06f4..2a0f736a9e 100644 --- a/packages/core/client/src/schema-component/antd/filter/useValues.ts +++ b/packages/core/client/src/schema-component/antd/filter/useValues.ts @@ -4,13 +4,13 @@ import flat from 'flat'; import cloneDeep from 'lodash/cloneDeep'; import get from 'lodash/get'; import { useContext, useEffect } from 'react'; -import { FilterContext, FilterLogicContext } from './context'; +import { FilterContext } from './context'; // import { useValues } from './useValues'; const findOption = (dataIndex = [], options) => { let items = options; let option; - dataIndex?.forEach?.((name, index) => { + dataIndex?.forEach?.((name) => { const item = items.find((item) => item.name === name); if (item) { option = item; @@ -22,7 +22,6 @@ const findOption = (dataIndex = [], options) => { export const useValues = () => { const field = useField(); - const logic = useContext(FilterLogicContext); const { options } = useContext(FilterContext); const data2value = () => { field.value = flat.unflatten({ @@ -48,7 +47,7 @@ export const useValues = () => { field.data.schema = merge(option?.schema, operator?.schema); field.data.value = get(field.value, `${fieldPath}.$${operatorValue}`); }; - useEffect(value2data, [logic]); + useEffect(value2data, [field.path.entire]); return { fields: options, ...field.data,