Skip to content

Commit

Permalink
fix(form-core): prevValidationResult initialize as empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
Joren Broekema committed Feb 23, 2021
1 parent f9fce2d commit b2a1c1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/loud-planes-doubt.md
@@ -0,0 +1,5 @@
---
'@lion/form-core': patch
---

Make sure prev validation result is always an array (of validators) and not undefined.
2 changes: 1 addition & 1 deletion packages/form-core/src/validate/ResultValidator.js
Expand Up @@ -10,7 +10,7 @@ export class ResultValidator extends Validator {
/**
* @param {Object} context
* @param {Validator[]} context.regularValidationResult
* @param {Validator[] | undefined} context.prevValidationResult
* @param {Validator[]} context.prevValidationResult
* @param {Validator[]} [context.validators]
* @returns {boolean}
*/
Expand Down
2 changes: 2 additions & 0 deletions packages/form-core/src/validate/ValidateMixin.js
Expand Up @@ -161,6 +161,8 @@ export const ValidateMixinImplementation = superclass =>
* @type {Validator[]}
*/
this.__validationResult = [];
/** @type {Validator[]} */
this.__prevValidationResult = [];

this.__onValidatorUpdated = this.__onValidatorUpdated.bind(this);
this._updateFeedbackComponent = this._updateFeedbackComponent.bind(this);
Expand Down

0 comments on commit b2a1c1e

Please sign in to comment.