Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-5029-fieldarray-schema-objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vee-validate": patch
---

Fix useFieldArray schema validation and meta updates for object items (#5029)
6 changes: 6 additions & 0 deletions packages/vee-validate/src/useField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ function _useField<TValue = unknown>(
return validateValidStateOnly();
}

// In validated-only mode, only validate fields that have been previously validated
// This prevents showing errors on fields the user hasn't interacted with yet (#5029)
if (opts?.mode === 'validated-only' && !meta.validated) {
return validateValidStateOnly();
}
Comment on lines +210 to +214
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix in useField.ts (lines 212-214) guards validate() in validated-only mode when !meta.validated, and this path is only reached when form.validate({ mode: 'validated-only' }) is called without a schema — i.e., when individual field validators are used. However, all 9 new tests use Zod validationSchema, so when form.validate() is called it goes through form.validateSchema() (see useForm.ts line 831-832) and the fixed code in useField.validate() is never reached.

A test that would actually cover the fixed behavior would need to use useField with per-field validation rules (instead of a form-level schema) alongside useFieldArray, mutate a field entry's value (triggering update()form.validate({ mode: 'validated-only' })), and verify that fields with meta.validated === false do NOT get their errors set, while already-validated fields still do.

Without such a test, a regression in the fix would go undetected.

Copilot uses AI. Check for mistakes.

return validateWithStateMutation();
}

Expand Down
Loading
Loading