-
Notifications
You must be signed in to change notification settings - Fork 628
Description
📝 Question Description
When using nested FieldArrays, deleting a parent FieldArray item with field.remove(index) causes a mismatch between outer and inner field names. The outer name updates correctly (e.g., outputs.3 → outputs.2), but the inner nested names remain unchanged (e.g., outputs.3.schema stays as outputs.3.schema instead of updating to outputs.2.schema). This causes errors on subsequent deletions.
Steps to Reproduce
Create a nested FieldArray structure (e.g., parent array with child arrays inside each item)
Remove an item from the parent FieldArray using field.remove(index)
Observe that outer field names update, but nested field names retain their old indices
Attempt another deletion operation - this triggers an error due to the name mismatch
Expected Behavior
When a parent FieldArray item is removed, all nested field names should automatically update to reflect the new indices.
Question
How can I force the Form to re-render after each deletion to ensure both outer and inner field names are properly synchronized and avoid subsequent errors?
original report:
FieldArray嵌套FieldArray时,如果对父级FieldArray的某一项做删除操作field.remove(index)后,外层的name会变(outputs.3 -> outputs.2),但内层的name好像没变(outputs.3.schema没有变成outputs.2.schema),下次删除时会报错
这种怎么可以在每次删除后重新render Form让内外的name都更新呢,避免后续报错
