Remove is not removing the field when using nested field arrays.

Describe the bug
When using nested field arrays. Remove is not really removing the field from the fields array. Instead, the field is set to undefined and fields array maintains the same length.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the CodeSandbox provided below
  2. Click on add child
  3. Click on add child
  4. in the console, fields will be [Object, Object]
  5. Click on remove child
  6. in the console, fields will be [Object, undefined]

Codesandbox link (Required)
https://codesandbox.io/s/hook-form-nested-field-array-t4m3g?file=/src/App.js

Expected behavior
The fields should me removed from the array and fields.length should reflect the actual fields count.

Desktop (please complete the following information):

  • OS: macOs
  • Browser: Chrome 88
  • Version 6.15.4

1 possible answer(s) on “Remove is not removing the field when using nested field arrays.