npm vee-validate 4.2.0

latest releases: 4.13.1, 4.13.0, 4.12.8...
3 years ago

This PR introduces several updates to the meta objects in both field and form APIs, these changes are considered breaking for non-intended use-cases, so it doesn't warrant a major release.

🆕 New Changes

dirty flag changes

The flag now acts as a changed flag, it will be read-only and will be set to true if the field current value is not deeply equal to its initial value.

The reason for this change is the dirty and touched flags are not that different from one another, so users end up using one or the other. Having the dirty flag reflects whether the form values have changed or not gives it more utility and is more valuable to several common tasks done by FE developers.

valid flag changes

Changes in this release has been overwritten by 4.2.1 due to bad DX

Rules and Empty Values

The global validators published under @vee-validate/rules didn't handle the empty values before, meaning they gave an incorrect behavior when used without required. The changes in this PR introduce a consistent behavior across all these rules:

  • If the value is empty, the value is valid
  • Empty values are: empty strings, empty arrays, null or undefined

That closely mirrors the behavior in v3 where validation is skipped for empty non-required fields, except now the validation passes rather than skipped. #3170

🐛 Bug Fixes

  • Fixed the checkboxes setting their initial value twice causing malformed form values #3183

Don't miss a new vee-validate release

NewReleases is sending notifications on new releases.