Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React admin not unmounting nested ArrayInputs #9839

Open
andriivitrenko opened this issue May 10, 2024 · 1 comment
Open

React admin not unmounting nested ArrayInputs #9839

andriivitrenko opened this issue May 10, 2024 · 1 comment

Comments

@andriivitrenko
Copy link

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
@erwanMarmelab
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants