github logaretm/vee-validate v4.10.0

latest releases: v4.12.8, v4.12.7, v4.12.6...
11 months ago

💣 Breaking Change

Disabled syncVModel by default #4283 (7ce9d67)

A lot of issues created because of this and valid issues and concerns by the community caused by useField auto model tracking causing unexpected behavior for a lot of people. The feature has been disabled by default starting from v4.10.0.

If you relied on useField doing auto modelValue and update:modelValue emitting then you need to turn it on by passing true to syncVModel.

const { ... } = useField('name', undefined, {
 syncVModel: true,
});

Check the discussion in #4283

This makes sense, because it being opt-in makes it less dangerous to cause unexpected behavior.

useForm#values is now readonly #4282 (05d957e)

the values object returned from useForm should have never been treated as mutable and the docs mentioned that a few times and didn't encourage it.

In this release, we mark it as readonly to make it clear to everyone that it should not be mutated directly. The main reason for this design choice is we need to be able to infer the user intent with those mutations. For example, if you clear an array, did you mean to reset the field or did you mean to change its value and trigger a validation?

Being able to infer the user intent is paramount for vee-validate to be able to handle such behaviors correctly, it has always been the case here, and marking it as readonly is just a hint that should've been there from the start.

This should not affect a lot of users.

💅 DX enhancements

  • Allow custom models for defineComponentBinds (bfd6b00)
  • handleBlur can be configured to run validations (d4fafc9)
  • useField#syncVModel also accepts the model prop name (3e4a7c1)
  • Allow multiple messages to be returned in a validator function #4322 #4318 (2cf0eec)

🐛 Bug Fixes

👕 TypeScript

vee-validate v4.10.0 requires vue@3.3 as it uses many of the newly introduced types to replace its own version of them, this should not affect your experience however it may produce type errors if you relied on some of these internal types. Like MaybeRefOrLazy replaced with MaybeRefOrGetter.

Don't miss a new vee-validate release

NewReleases is sending notifications on new releases.