fix(linkageRules): remove throttle to prevent unexpected behavior

This commit is contained in:
Rain 2023-11-29 17:52:56 +08:00
parent 136e5405ed
commit f3c6f066ec

View File

@ -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) {