Skip to content

Commit

Permalink
fix: set the required flag after reset closes #2323
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Sep 12, 2019
1 parent af3ac11 commit d623df1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/components/Provider.ts
Expand Up @@ -35,7 +35,6 @@ function data() {
initialValue: undefined,
flags: createFlags(),
failedRules: {},
forceRequired: false,
isDeactivated: false,
id: ''
};
Expand Down Expand Up @@ -143,9 +142,8 @@ export const ValidationProvider = (Vue as withProviderPrivates).extend({
},
isRequired(): boolean {
const rules = { ...this._resolvedRules, ...this.normalizedRules };
const forceRequired = this.forceRequired;

const isRequired = Object.keys(rules).some(RuleContainer.isRequireRule) || forceRequired;
const isRequired = Object.keys(rules).some(RuleContainer.isRequireRule);
this.flags.required = !!isRequired;

return isRequired;
Expand Down Expand Up @@ -199,6 +197,7 @@ export const ValidationProvider = (Vue as withProviderPrivates).extend({
this.messages = [];
this.initialValue = this.value;
const flags = createFlags();
flags.required = this.isRequired;
this.setFlags(flags);
this.validateSilent();
},
Expand Down

0 comments on commit d623df1

Please sign in to comment.