Deeply nested array form prunes array attributes, when bound to vee-validate useField and used with 'replace' from useFieldArray

Author: IklonCreated Mar 19, 2026Updated Mar 19, 2026

What happened?

Problem arises when dealing with deeply nested array/object forms. If I use 'replace' method with argument '[]' (from useFieldArray) on the most deeply nested array and useFiled with its attributes, the attribute containing the array gets deleted from the result.

For better understanding, please visit the minimal reproduciotn project.

Reproduction steps

See the attached project: https://stackblitz.com/edit/vitejs-vite-nprrmhhc?file=src%2Fcomponents%2FSubject.vue

Reproduction is following:

  1. Click any button 'Replace subjects with an empty array' (or even many of them)
  2. Click submit
  3. You should see 'Success' in the console with form values.

This is fine and works since the component Subject.vue doesnt bind any fileds to the form.

But refresh the project than for a clean start and in the Subject.vue comment this part:

// Not registering any vee validate fields - working version
const id = 1;
const note = 'test';

and uncomment this part:

// Registering some vee validate fields - non working version
/*
const id = useFieldValue(
() =>
  `gradeDefinitions[${gradeDefinitionIndex}].subjectDefinitions[${subjectDefinitionIndex}].subjects[${index}].id`
);
const { value: note } = useField(
  () =>
  `gradeDefinitions[${gradeDefinitionIndex}].subjectDefinitions[${subjectDefinitionIndex}].subjects[${index}].note`
);
*/

this bounds additional fields to each of the 'subjects'.

Now do the same steps as before:

  1. Click any button 'Replace subjects with an empty array' (or even many of them)
  2. Click submit
  3. You should see 'Fail' in the console.

This is because the attribute 'subejcts' got completely pruned from the SubjectDefinition object. The form is now not valid and the validation process fails. This is not an expected behaviour.

Version

Vue.js 3.x and vee-validate 5.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

bash

Demo link

https://stackblitz.com/edit/vitejs-vite-nprrmhhc?file=src%2Fcomponents%2FSubject.vue

Code of Conduct