z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.14k stars 2.81k forks source link

HasMany field new_{index} key in js resets to zero after validation fails #5818

Open alexoleynik0 opened 1 year ago

alexoleynik0 commented 1 year ago

Description:

When using HasMany field and validation fails somewhere in the Form, it resets new items index to zero always, so if you try to add new Item on the second attempt, you will have to HasMany items with key new_1, which will override one another without any warnings.

Steps To Reproduce:

And all this even assuming you have followed the instruction described in this issue, regarding wrong key mapping in the HasMany field after validation fails. Without it you will see your HasMany Items disappearing on every form submit.