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

[v3] ReferenceArrayInput don't work properly with AutocompleteArrayInput #4021

Closed
ViktorShapoval opened this issue Nov 22, 2019 · 3 comments · Fixed by #4042
Closed

[v3] ReferenceArrayInput don't work properly with AutocompleteArrayInput #4021

ViktorShapoval opened this issue Nov 22, 2019 · 3 comments · Fixed by #4042
Assignees
Labels

Comments

@ViktorShapoval
Copy link

ViktorShapoval commented Nov 22, 2019

What you were expecting:
Components to work properly

What happened instead:
When using components like this

<ReferenceArrayInput>
  <AutocompleteArrayInput/>
<ReferenceArrayInput/>

if you have already some values there from your api and try to add new values, old values names will dissapear

  1. Screenshot from 2019-11-22 11-35-12
  2. Screenshot from 2019-11-22 11-35-19
  3. Screenshot from 2019-11-22 11-35-24

Steps to reproduce:
I was able to reproduce this issue in the react-admin demo with just a few additional lines of code to show a new tab and add the required data to data-generator.
Here is my version for it.

  1. git clone https://github.com/theVeid/react-admin.git
  2. cd react-admin
  3. git checkout issue-reference-array-input
  4. make install
  5. make build
  6. make run-demo
  7. Go to http://localhost:3000/#/customers/690/commands
  8. Try to add new value from the dropdown
  9. You see the bug

Related code:
https://github.com/theVeid/react-admin.git at issue-reference-array-input branch
Only changes I've made

// react-admin/examples/demo/src/visitors/VisitorEdit.js
<FormTab label={'Commands'} path={'commands'}>
    <ReferenceArrayInput
        source={'commands_ids'}
        reference={'commands'}
    >
        <AutocompleteArrayInput optionText={'reference'} />
    </ReferenceArrayInput>
</FormTab>
// react-admin/examples/data-generator/src/customers
return {
  id,
  first_name,
  ...,
 commands_ids: [376, 84, 506], // new line
}

Environment

  • React-admin version: 3.0.0
  • Last version that did not exhibit the issue (if applicable): 2.9.9
  • React version: 16.9.0
  • Browser: Chrome 78
  • Stack trace (in case of a JS error):
@fzaninotto
Copy link
Member

I can't reproduce the problem with the code you've provided on 3.0 in the simple example and demo example. There must be an error somewhere else in your code. Can you try and publish a CodeSandbox demonstrating the issue?

@ViktorShapoval
Copy link
Author

@fzaninotto This bug is also occurring in codesandbox simple demo https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple, here is the gif.

codesanbox gif example

Thanks for looking into it. This is the bug that is mostly preventing me from an upgrade to v3.

@fzaninotto
Copy link
Member

oh, now I get it, you need to type characters to trigger the bug. Thanks for the GIF and the bug report, we'll look into it.

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

Successfully merging a pull request may close this issue.

2 participants