From 8f900871ace30895d9fee84c4eb9018c0ad0450e Mon Sep 17 00:00:00 2001 From: invalid w Date: Mon, 30 Oct 2023 12:23:43 +0800 Subject: [PATCH] perf(useForm): If the args of the setFieldsValue is empty, it will not be executed. close #3209 --- src/components/Form/src/hooks/useFormEvents.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/Form/src/hooks/useFormEvents.ts b/src/components/Form/src/hooks/useFormEvents.ts index 8a77cc63734..2112b7cc694 100644 --- a/src/components/Form/src/hooks/useFormEvents.ts +++ b/src/components/Form/src/hooks/useFormEvents.ts @@ -111,6 +111,10 @@ export function useFormEvents({ * @description: Set form value */ async function setFieldsValue(values: Recordable): Promise { + if (Object.keys(values).length === 0) { + return; + } + const fields = getAllFields(); // key 支持 a.b.c 的嵌套写法