From 31e95e3dec2ac9d449ecfe8b015be5f868d728ad Mon Sep 17 00:00:00 2001 From: Junyi Date: Thu, 7 Apr 2022 07:59:17 +0800 Subject: [PATCH] fix(client): meet undefined error after clear filter cascader value (#267) --- .../client/src/schema-component/antd/filter/useValues.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/client/src/schema-component/antd/filter/useValues.ts b/packages/client/src/schema-component/antd/filter/useValues.ts index d55a866946..deee2bd4da 100644 --- a/packages/client/src/schema-component/antd/filter/useValues.ts +++ b/packages/client/src/schema-component/antd/filter/useValues.ts @@ -24,7 +24,7 @@ export const useValues = () => { const { options } = useContext(FilterContext); const data2value = () => { field.value = flat.unflatten({ - [`${field.data.dataIndex.join('.')}.${field.data?.operator?.value}`]: field.data?.value, + [`${field.data.dataIndex?.join('.')}.${field.data?.operator?.value}`]: field.data?.value, }); }; const value2data = () => { @@ -63,9 +63,9 @@ export const useValues = () => { const option = findOption(dataIndex, options); const operator = option?.operators?.[0]; field.data = field.data || {}; - field.data.operators = option.operators; + field.data.operators = option?.operators; field.data.operator = operator; - field.data.schema = merge(option.schema, operator.schema); + field.data.schema = merge(option?.schema, operator?.schema); field.data.dataIndex = dataIndex; field.data.value = null; data2value();