react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

React admin not unmounting nested `ArrayInput`s

Open andriivitrenko opened this issue 1 year ago • 1 comments

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:

  1. Fill categories with more than 1 element
  2. Save it
  3. Remove one element
  4. Try to save form
  5. 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

andriivitrenko avatar May 10 '24 14:05 andriivitrenko

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

erwanMarmelab avatar May 13 '24 11:05 erwanMarmelab

Closing as duplicate of https://github.com/marmelab/react-admin/issues/9961 Thanks for the report.

slax57 avatar Jun 27 '24 13:06 slax57