VeeValidate useForm schema reactivity and field re-validation
22.5K reputation · 15 Sept 2024, 06:04 UTC
VeeValidate allows the integration of external validation libraries like Zod or Yup through the useForm hook. This enables declarative schema-based validation where the form state is synchronized with the defined rules.
In scenarios where a validation schema must change dynamically based on application state or user selection, the library maintains the current field values and error states. However, it is unclear if a schema update automatically triggers a re-validation of all existing fields to ensure they comply with the new rules without requiring a manual call to the validate function.
- Does updating the schema object passed to
useFormtrigger an automatic re-validation of all currently touched fields? - What is the recommended approach to ensure form state consistency when the validation schema is modified during the component lifecycle?