From e5f711ec663c2aac5948cbbc5747b84e88d609df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=AB=E9=9B=A8=E6=B0=B4=E8=BF=87=E6=BB=A4=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E6=B0=94-Rain?= <958414905@qq.com> Date: Fri, 24 Nov 2023 17:35:45 +0800 Subject: [PATCH] fix: avoid infinite loop (#3089) --- .../src/schema-component/antd/form-v2/Form.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 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 2015092fa..7a67ccf00 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 @@ -138,14 +138,14 @@ const WithForm = (props: WithFormProps) => { variables, localVariables, }); - // 如果是 linkageRules 数组的最后一个元素 if (index === linkageRules.length - 1) { - // 清空 linkagefields 数组中对象的属性 - linkagefields.forEach((v) => { - v.linkageProperty = {}; + // 如果不在这里使用 setTimeout 会在某些未知情况下导致死循环,原因未知 + setTimeout(() => { + linkagefields.forEach((v) => { + v.linkageProperty = {}; + }); + linkagefields.length = 0; }); - // 清空 linkagefields 数组 - linkagefields.length = 0; } }), );