mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:26:36 +00:00
fix(linkage): avoid infinite loop (#3069)
This commit is contained in:
parent
45dcdab083
commit
19bad669af
@ -140,8 +140,6 @@ const WithForm = (props: WithFormProps) => {
|
|||||||
});
|
});
|
||||||
// 如果是 linkageRules 数组的最后一个元素
|
// 如果是 linkageRules 数组的最后一个元素
|
||||||
if (index === linkageRules.length - 1) {
|
if (index === linkageRules.length - 1) {
|
||||||
// 等待异步操作完成
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
||||||
// 清空 linkagefields 数组中对象的属性
|
// 清空 linkagefields 数组中对象的属性
|
||||||
linkagefields.forEach((v) => {
|
linkagefields.forEach((v) => {
|
||||||
v.linkageProperty = {};
|
v.linkageProperty = {};
|
||||||
|
@ -43,12 +43,8 @@ export const linkageMergeAction = async ({
|
|||||||
...field.linkageProperty,
|
...field.linkageProperty,
|
||||||
required: requiredResult,
|
required: requiredResult,
|
||||||
};
|
};
|
||||||
return new Promise((resolve) => {
|
field.required = last(field.linkageProperty.required);
|
||||||
setTimeout(() => {
|
break;
|
||||||
field.required = last(field.linkageProperty.required);
|
|
||||||
});
|
|
||||||
resolve(void 0);
|
|
||||||
});
|
|
||||||
case ActionType.InRequired:
|
case ActionType.InRequired:
|
||||||
if (await conditionAnalyses({ rules: condition, variables, localVariables })) {
|
if (await conditionAnalyses({ rules: condition, variables, localVariables })) {
|
||||||
requiredResult.push(false);
|
requiredResult.push(false);
|
||||||
@ -57,12 +53,8 @@ export const linkageMergeAction = async ({
|
|||||||
...field.linkageProperty,
|
...field.linkageProperty,
|
||||||
required: requiredResult,
|
required: requiredResult,
|
||||||
};
|
};
|
||||||
return new Promise((resolve) => {
|
field.required = last(field.linkageProperty.required);
|
||||||
setTimeout(() => {
|
break;
|
||||||
field.required = last(field.linkageProperty.required);
|
|
||||||
});
|
|
||||||
resolve(void 0);
|
|
||||||
});
|
|
||||||
case ActionType.Visible:
|
case ActionType.Visible:
|
||||||
case ActionType.None:
|
case ActionType.None:
|
||||||
case ActionType.Hidden:
|
case ActionType.Hidden:
|
||||||
@ -73,12 +65,8 @@ export const linkageMergeAction = async ({
|
|||||||
...field.linkageProperty,
|
...field.linkageProperty,
|
||||||
display: displayResult,
|
display: displayResult,
|
||||||
};
|
};
|
||||||
return new Promise((resolve) => {
|
field.display = last(displayResult);
|
||||||
setTimeout(() => {
|
break;
|
||||||
field.display = last(displayResult);
|
|
||||||
});
|
|
||||||
resolve(void 0);
|
|
||||||
});
|
|
||||||
case ActionType.Editable:
|
case ActionType.Editable:
|
||||||
case ActionType.ReadOnly:
|
case ActionType.ReadOnly:
|
||||||
case ActionType.ReadPretty:
|
case ActionType.ReadPretty:
|
||||||
@ -89,12 +77,8 @@ export const linkageMergeAction = async ({
|
|||||||
...field.linkageProperty,
|
...field.linkageProperty,
|
||||||
pattern: patternResult,
|
pattern: patternResult,
|
||||||
};
|
};
|
||||||
return new Promise((resolve) => {
|
field.pattern = last(patternResult);
|
||||||
setTimeout(() => {
|
break;
|
||||||
field.pattern = last(patternResult);
|
|
||||||
});
|
|
||||||
resolve(void 0);
|
|
||||||
});
|
|
||||||
case ActionType.Value:
|
case ActionType.Value:
|
||||||
if (isConditionEmpty(condition) || (await conditionAnalyses({ rules: condition, variables, localVariables }))) {
|
if (isConditionEmpty(condition) || (await conditionAnalyses({ rules: condition, variables, localVariables }))) {
|
||||||
if (value?.mode === 'express') {
|
if (value?.mode === 'express') {
|
||||||
|
Loading…
Reference in New Issue
Block a user