Skip to content

Commit

Permalink
fix: fix: call invalidate() with deep argument
Browse files Browse the repository at this point in the history
  • Loading branch information
foxhound87 committed Jan 14, 2024
1 parent 6face47 commit da37640
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 6.8.2 (master)
- Fix: call `invalidate()` with `deep` argument.

# 6.8.1 (master)
- Fix: call `invalidate()` with `async` argument.

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(_.head(validation.errors.get(field.path)));
field.invalidate(_.head(validation.errors.get(field.path)), false);
}

validateFieldAsync(field, data) {
Expand Down Expand Up @@ -138,7 +138,7 @@ export class DVR implements ValidationPluginInterface {

executeAsyncValidation(field) {
if (field.validationAsyncData.valid === false) {
field.invalidate(field.validationAsyncData.message, true);
field.invalidate(field.validationAsyncData.message, false, true);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/validators/SVK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class SVK implements ValidationPluginInterface {
// add additional info to the message
const msg = `${field.label} ${fieldErrorObj.message}`;
// invalidate the current field with message
field.invalidate(msg);
field.invalidate(msg, false);
}

handleAsyncError(field, errors) {
Expand All @@ -124,7 +124,7 @@ class SVK implements ValidationPluginInterface {

executeAsyncValidation(field) {
if (field.validationAsyncData.valid === false) {
field.invalidate(field.validationAsyncData.message, true, true);
field.invalidate(field.validationAsyncData.message, false, true);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/validators/VJF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ export class VJF implements ValidationPluginInterface {
executeValidation(field) {
// otherwise find an error message to show
field.validationFunctionsData.map(
(rule) => rule.valid === false && field.invalidate(rule.message)
(rule) => rule.valid === false && field.invalidate(rule.message, false)
);
}

executeAsyncValidation(field) {
if (field.validationAsyncData.valid === false) {
field.invalidate(field.validationAsyncData.message, true, true);
field.invalidate(field.validationAsyncData.message, false, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/validators/YUP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class YUP implements ValidationPluginInterface {

executeAsyncValidation(field) {
if (field.validationAsyncData.valid === false) {
field.invalidate(field.validationAsyncData.message, true, true);
field.invalidate(field.validationAsyncData.message, false, true);
}
}
}
Expand Down

0 comments on commit da37640

Please sign in to comment.