Browse Source

fix: [form] using formApi.setValue to reset ArrayField not work when pass empty object, close #211

pointhalo 4 years ago
parent
commit
8b1238f03b
1 changed files with 1 additions and 5 deletions
  1. 1 5
      packages/semi-foundation/form/foundation.ts

+ 1 - 5
packages/semi-foundation/form/foundation.ts

@@ -384,11 +384,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
         if (this.registeredArrayField.size) {
         if (this.registeredArrayField.size) {
             const arrayFieldPaths = [...this.registeredArrayField.keys()];
             const arrayFieldPaths = [...this.registeredArrayField.keys()];
             arrayFieldPaths.forEach(path => {
             arrayFieldPaths.forEach(path => {
-                // if values includes arrayField's fieldPath as key
-                const pathVal = ObjectUtil.get(values, path);
-                if (pathVal) {
-                    this.updateArrayField(path, { updateKey: new Date().valueOf() });
-                }
+                this.updateArrayField(path, { updateKey: new Date().valueOf() });
             });
             });
         }
         }
         // When isOverrid is true, there may be a non-existent field in the values passed in, directly synchronized to formState.values
         // When isOverrid is true, there may be a non-existent field in the values passed in, directly synchronized to formState.values