Assuming you have a Form with HasMany field used, and you decided to delete already existing Item from there, but Form validation failed somewhere - on the second render you won't see those Items you previously removed, but if Form submission now succeeds you will get that removed item back as it won't be passed with form data to be removed on the second time.
Steps To Reproduce:
Create Form with HasMany field, create some Items and save.
Open that main Instance to Edit, make some changes to invalidate form (leave required field empty for example).
Remove one of the HasMany Items.
Submit form, see validation errors. Notice that you don't see removed HasMany Item.
Fix validation errors and submit the From again.
Now the supposedly removed HasMany Item appears in the Form again, as it is not removed.
I assume the solution could be in the HasMany::buildRelatedForms method on the lines where it skips Items that has remove_flag checked. Maybe there should be some check if that Item has ID and then render only hidden input with remove_flag for that Item, so it could be removed on valid Form submission.
Description:
Assuming you have a Form with HasMany field used, and you decided to delete already existing Item from there, but Form validation failed somewhere - on the second render you won't see those Items you previously removed, but if Form submission now succeeds you will get that removed item back as it won't be passed with form data to be removed on the second time.
Steps To Reproduce:
I assume the solution could be in the
HasMany::buildRelatedForms
method on the lines where it skips Items that has remove_flag checked. Maybe there should be some check if that Item has ID and then render only hidden input with remove_flag for that Item, so it could be removed on valid Form submission.