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

ArrayInput remove an item on a flat string array #7124

Closed
divanitskiy opened this issue Jan 21, 2022 · 2 comments
Closed

ArrayInput remove an item on a flat string array #7124

divanitskiy opened this issue Jan 21, 2022 · 2 comments
Labels

Comments

@divanitskiy
Copy link

What you were expecting:
ArrayInput component should remove the exact item a user clicks.

Initial data:
string_array: ["val1"]

What happened instead:
A wrong item was removed.

Steps to reproduce:
Scenario 1.

  1. Edit a post. Note that it contains: string_array: ["val1"]
  2. Add a second item to the String array property and leave it empty.
  3. Add a third item val3.
  4. Try removing the first item - the second item is removed instead.

Scenario 2.

  1. Edit a post. Note that it contains: string_array: ["val1"]
  2. Remove the first item of the String array property.
  3. Add a new item - it should be empty but we get val1 instead.

Related code:

https://codesandbox.io/s/loving-shockley-fbvq2?file=/src/data.tsx

<ArrayInput source="string_array">
            <SimpleFormIterator>
              <TextInput source="" fullWidth />
            </SimpleFormIterator>
</ArrayInput>

Other information:

Environment

  • React-admin version: 3.19.6
  • Last version that did not exhibit the issue (if applicable):
  • React version: 17.0.0
  • Browser: Chrome
  • Stack trace (in case of a JS error):
@WiXSL WiXSL added the bug label Jan 21, 2022
@WiXSL
Copy link
Contributor

WiXSL commented Jan 21, 2022

Thanks for the report.

@WiXSL
Copy link
Contributor

WiXSL commented Jan 21, 2022

Fixed by #7123

@WiXSL WiXSL closed this as completed Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants