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

AutocompleteArrayInput becomes empty after search #8410

Closed
magicxor opened this issue Nov 21, 2022 · 3 comments
Closed

AutocompleteArrayInput becomes empty after search #8410

magicxor opened this issue Nov 21, 2022 · 3 comments
Labels

Comments

@magicxor
Copy link

What you were expecting:
Search adds a new item; the old items remain intact.

What happened instead:
Search adds a new item; the old items disappear.

ezgif-3-b23f9c2b1d

Steps to reproduce:

  1. Launch codesandbox or the code from the repo directly.
  2. Open http://localhost:3000/#/user/112 (edit achievements of user 112)
  3. Start typing

Related code:
Repro: https://github.com/magicxor/react-admin-repro-AutocompleteArrayInput-bug

        <ReferenceArrayInput label="Achievements" source="achievements" format={formatAnyArray} reference="achievement" allowEmpty fullWidth>
          <AutocompleteArrayInput optionText={o => o.name} format={formatAnyArray} filterToQuery={createSearchFilter} disableClearable clearOnBlur={false} fullWidth />
        </ReferenceArrayInput>

Other information:
I guess that the bug reproduces when there is format attribute in ReferenceArrayInput and AutocompleteArrayInput tags.

Environment

  • React-admin version: ^4.5.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: ^18.2.0
  • Browser: Chrome 107.0.5304.107 (Official Build) (64-bit) and Firefox 107.0 (64-bit)
  • Stack trace (in case of a JS error):
@WiXSL
Copy link
Contributor

WiXSL commented Nov 21, 2022

Most of the props you set up to your ReferenceArrayInput should be pass to its children:
https://marmelab.com/react-admin/Upgrade.html#referenceinput-and-referencearrayinput-no-longer-accepts-common-props

But the bug is reproducible regardless of this, so I'm marking this as such.

@WiXSL WiXSL added the bug label Nov 21, 2022
@WiXSL
Copy link
Contributor

WiXSL commented Nov 22, 2022

Duplicate of #8181

@WiXSL WiXSL marked this as a duplicate of #8181 Nov 22, 2022
@fzaninotto
Copy link
Member

As it's a duplicate, I'm closing this bug in favor of the other one. Thanks for the report!

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

3 participants