Skip to content

Commit

Permalink
fix: reset validation action for mobx strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
foxhound87 committed Jan 7, 2024
1 parent ff08c81 commit 63ea8c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 6.7.3 (master)
- Fix: reset validation action for mobx strict mode

# 6.7.2 (master)
- Fix: mobx strict mode for hooks and handlers

Expand Down
1 change: 1 addition & 0 deletions src/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default class Form extends Base implements FormInterface {
invalidate: action,
clear: action,
reset: action,
resetValidation: action,
});

this.name = name;
Expand Down
4 changes: 2 additions & 2 deletions src/validators/DVR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class DVR implements ValidationPluginInterface {
// check validation
if (validation.passes()) return;
// the validation is failed, set the field error
field.invalidate(_.first(validation.errors.get(field.path)));
field.invalidate(_.head(validation.errors.get(field.path)));
}

validateFieldAsync(field, data) {
Expand Down Expand Up @@ -129,7 +129,7 @@ export class DVR implements ValidationPluginInterface {
handleAsyncFails(field, validation, resolve) {
field.setValidationAsyncData(
false,
_.first(validation.errors.get(field.path))
_.head(validation.errors.get(field.path))
);
this.executeAsyncValidation(field);
field.showAsyncErrors();
Expand Down

0 comments on commit 63ea8c8

Please sign in to comment.