From f3c6f066ec161f1ff15937e93034e0613bcf6451 Mon Sep 17 00:00:00 2001 From: Rain <958414905@qq.com> Date: Wed, 29 Nov 2023 17:52:56 +0800 Subject: [PATCH] fix(linkageRules): remove throttle to prevent unexpected behavior --- .../core/client/src/schema-component/antd/form-v2/Form.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.tsx index dfec1f542..2906e5223 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.tsx @@ -6,7 +6,6 @@ import { reaction } from '@formily/reactive'; import { uid } from '@formily/shared'; import { getValuesByPath } from '@nocobase/utils/client'; import { ConfigProvider, Spin } from 'antd'; -import _ from 'lodash'; import React, { useEffect, useMemo } from 'react'; import { useActionContext } from '..'; import { useAttach, useComponent } from '../..'; @@ -234,7 +233,7 @@ function getSubscriber( variables: VariablesContextType, localVariables: VariableOption[], ): (value: string, oldValue: string) => void { - return _.throttle(() => { + return () => { // 当条件改变触发 reaction 时,会同步收集字段状态,并保存到 field.stateOfLinkageRules 中 collectFieldStateOfLinkageRules({ operator: action.operator, @@ -276,7 +275,7 @@ function getSubscriber( // 在这里清空 field.stateOfLinkageRules,就可以保证:当条件再次改变时,如果该字段没有和任何条件匹配,则需要把对应的值恢复到初始值; field.stateOfLinkageRules[fieldName] = null; }); - }, 500); + }; } function getFieldNameByOperator(operator: ActionType) {