fix(linkage): avoid infinite loop (#3069)

This commit is contained in:
被雨水过滤的空气-Rain 2023-11-21 17:28:37 +08:00 committed by GitHub
parent 45dcdab083
commit 19bad669af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 26 deletions

View File

@ -140,8 +140,6 @@ const WithForm = (props: WithFormProps) => {
});
// 如果是 linkageRules 数组的最后一个元素
if (index === linkageRules.length - 1) {
// 等待异步操作完成
await new Promise((resolve) => setTimeout(resolve, 0));
// 清空 linkagefields 数组中对象的属性
linkagefields.forEach((v) => {
v.linkageProperty = {};

View File

@ -43,12 +43,8 @@ export const linkageMergeAction = async ({
...field.linkageProperty,
required: requiredResult,
};
return new Promise((resolve) => {
setTimeout(() => {
field.required = last(field.linkageProperty.required);
});
resolve(void 0);
});
break;
case ActionType.InRequired:
if (await conditionAnalyses({ rules: condition, variables, localVariables })) {
requiredResult.push(false);
@ -57,12 +53,8 @@ export const linkageMergeAction = async ({
...field.linkageProperty,
required: requiredResult,
};
return new Promise((resolve) => {
setTimeout(() => {
field.required = last(field.linkageProperty.required);
});
resolve(void 0);
});
break;
case ActionType.Visible:
case ActionType.None:
case ActionType.Hidden:
@ -73,12 +65,8 @@ export const linkageMergeAction = async ({
...field.linkageProperty,
display: displayResult,
};
return new Promise((resolve) => {
setTimeout(() => {
field.display = last(displayResult);
});
resolve(void 0);
});
break;
case ActionType.Editable:
case ActionType.ReadOnly:
case ActionType.ReadPretty:
@ -89,12 +77,8 @@ export const linkageMergeAction = async ({
...field.linkageProperty,
pattern: patternResult,
};
return new Promise((resolve) => {
setTimeout(() => {
field.pattern = last(patternResult);
});
resolve(void 0);
});
break;
case ActionType.Value:
if (isConditionEmpty(condition) || (await conditionAnalyses({ rules: condition, variables, localVariables }))) {
if (value?.mode === 'express') {