From 63ea8c859876d7638e752cc8130d94d405a4f623 Mon Sep 17 00:00:00 2001 From: foxhound87 Date: Sun, 7 Jan 2024 11:21:06 +0100 Subject: [PATCH] fix: reset validation action for mobx strict mode --- CHANGELOG.md | 3 +++ src/Form.ts | 1 + src/validators/DVR.ts | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc7eb753..3bcd6995 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Form.ts b/src/Form.ts index 000d6327..de27a59e 100755 --- a/src/Form.ts +++ b/src/Form.ts @@ -47,6 +47,7 @@ export default class Form extends Base implements FormInterface { invalidate: action, clear: action, reset: action, + resetValidation: action, }); this.name = name; diff --git a/src/validators/DVR.ts b/src/validators/DVR.ts index 1936b421..5939b06a 100755 --- a/src/validators/DVR.ts +++ b/src/validators/DVR.ts @@ -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) { @@ -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();