Kaynağa Gözat

perf(useForm): If the args of the setFieldsValue is empty, it will not be executed. close #3209

invalid w 1 yıl önce
ebeveyn
işleme
8f900871ac

+ 4 - 0
src/components/Form/src/hooks/useFormEvents.ts

@@ -111,6 +111,10 @@ export function useFormEvents({
    * @description: Set form value
    */
   async function setFieldsValue(values: Recordable): Promise<void> {
+    if (Object.keys(values).length === 0) {
+      return;
+    }
+
     const fields = getAllFields();
 
     // key 支持 a.b.c 的嵌套写法