Skip to content

Commit 55ac899

Browse files
committed
fix(Form): reset status on setFieldValue * 2
1 parent 78b0757 commit 55ac899

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/form/Form/use-form.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ export class CubeFormInstance<
8484
}
8585

8686
if (!field || isEqual(field.value, newData[name])) {
87-
if (field && touched === false) {
87+
if (field) {
8888
field.errors = [];
89+
field.status = undefined;
8990
}
9091

9192
return;
@@ -98,12 +99,13 @@ export class CubeFormInstance<
9899
}
99100

100101
field.inputValue = newData[name];
102+
field.errors = [];
103+
field.status = undefined;
101104

102105
if (touched === true) {
103106
field.touched = touched;
104107
} else if (touched === false) {
105108
field.touched = false;
106-
field.errors = [];
107109
}
108110
});
109111

@@ -181,16 +183,13 @@ export class CubeFormInstance<
181183
}
182184

183185
field.inputValue = value;
186+
field.errors = [];
184187
field.status = undefined;
185188

186189
if (isTouched) {
187190
field.touched = isTouched;
188191
}
189192

190-
if (!skipRender) {
191-
field.errors = [];
192-
}
193-
194193
if (isTouched && !inputOnly) {
195194
this.onValuesChange && this.onValuesChange(this.getFormData());
196195
this.submitError = null;

0 commit comments

Comments
 (0)