Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
$lastInvalid
sync assignment from theresults.$invalid
computedbecause computed props should be side-effect free.
$lastCommittedOn
as a watch source because3.4.x
vue will cachecomputed more aggressively and
$lastInvalidState
would be out of syncin the "commit() called when model valid" scenario:
$commit()
sets$lastInvalidState
totrue
false
result.$invalid
computed is alreadyfalse
(initial), so it will not recompute (cached)watcher
will not be triggered because$result.$invalid
dep did not change.$invalidState
is not sync to false — to matchresult.$invalid
, and thus$model
change triggers validators to run immediately.last invalid state will be flipped to false since sync validators run first
and turn invalid to false "before" pending is set to true and it will prevent
them from running (Guessing). At least is required for 3.4.x and that's
the version the majority should be using.
I don't know if it's out-of-scope of this PR to update vue, but 3.4.x
brought many changes to computed optimization which vuelidate relies on
heavily and it's the future.
fixes #1237
Metadata
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
next
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)