react-admin
react-admin copied to clipboard
React admin not unmounting nested `ArrayInput`s
What you were expecting:
I have a form with nested ArrayInputs and those inputs are required to make sure that they have at least one element. And I wanted to remove one of categories from the list. The list was not empty and I expected successfully save it.
What happened instead:
Instead I received error in removed element that rows are required.
Steps to reproduce:
- Fill
categorieswith more than 1 element - Save it
- Remove one element
- Try to save form
- See error
Related code:
<ArrayInput source="categories" validate={required()}>
<SimpleFormIterator>
<ArrayInput source="rows" validate={required()}>
<SimpleFormIterator>
<TextInput source="title" validate={required()} />
</SimpleFormIterator>
</ArrayInput>
</SimpleFormIterator>
</ArrayInput>
Environment
- React-admin version: 4.16.12
- React version: 18.2.0
- Browser: latest
Hello @andriivitrenko,
Could you please make a stackblitz or a codesandbox
I made a first experimentation on this Stackblitz repo but this bug doesn't appears
Closing as duplicate of https://github.com/marmelab/react-admin/issues/9961 Thanks for the report.