From bbe7eed314d86fc6a6d6917509e4ad981a210b98 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 25 Oct 2023 21:45:52 +0800 Subject: [PATCH] fix: linkage rules cause abnormal field display (#2913) --- .../src/schema-component/antd/form-v2/Form.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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 8cf79fc82..cb9660b85 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 @@ -146,12 +146,16 @@ const WithForm = (props: WithFormProps) => { variables, localVariables, }); + // 如果是 linkageRules 数组的最后一个元素 if (index === linkageRules.length - 1) { - setTimeout(() => - linkagefields.map((v) => { - v.linkageProperty = {}; - }), - ); + // 等待异步操作完成 + await new Promise((resolve) => setTimeout(resolve, 0)); + // 清空 linkagefields 数组中对象的属性 + linkagefields.forEach((v) => { + v.linkageProperty = {}; + }); + // 清空 linkagefields 数组 + linkagefields.length = 0; } }), );