From c8c081eba51840f673304bf801b7ed103a3c48a5 Mon Sep 17 00:00:00 2001 From: Rairn <958414905@qq.com> Date: Mon, 8 May 2023 07:25:54 +0800 Subject: [PATCH] fix(filter-form): avoid error --- .../client/src/schema-component/antd/filter/useOperators.ts | 2 +- .../schema-component/antd/form-item/SchemaSettingOptions.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/filter/useOperators.ts b/packages/core/client/src/schema-component/antd/filter/useOperators.ts index ad70eca693..63dff96ec6 100644 --- a/packages/core/client/src/schema-component/antd/filter/useOperators.ts +++ b/packages/core/client/src/schema-component/antd/filter/useOperators.ts @@ -5,7 +5,7 @@ import { useCollection, useCollectionManager } from '../../../collection-manager * 获取当前字段所支持的操作符列表 * @returns */ -export const useOperatorList = () => { +export const useOperatorList = (): any[] => { const schema = useFieldSchema(); const fieldInterface = schema['x-designer-props']?.interface; const { name } = useCollection(); diff --git a/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx b/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx index 3e98a09028..b7bc0fd04a 100644 --- a/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/SchemaSettingOptions.tsx @@ -522,7 +522,7 @@ export const EditOperator = () => { const { t } = useTranslation(); const { dn } = useDesignable(); const operatorList = useOperatorList(); - const { operators: storedOperators, uid } = findFilterOperators(fieldSchema); + const { operators: storedOperators = {}, uid } = findFilterOperators(fieldSchema); if (operatorList.length && !storedOperators[fieldSchema.name]) { storedOperators[fieldSchema.name] = operatorList[0].value;