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

Reference Array selected item from a filter query vanishes immediately after selection. #9708

Closed
JustinHarshbarger opened this issue Mar 12, 2024 · 3 comments

Comments

@JustinHarshbarger
Copy link

What you were expecting:
Expected item to stay in the displayed selection after choosing the item (from search).

What happened instead:
Selected item is removed from the list very quickly.

Steps to reproduce:
Create a reference and choose a small page size. Using the autocomplete filter to find an element from the API that is outside the perPage range. Select the item and it will vanish once the reference data is fetched again (right after selection).

The issue can be resolved if I set the perPage value large enough to make sure all the entries for the resource are fetched at once (which is a very large number in this instance).

Related code:
Here is a sample that reproduces the issue :

<ReferenceArrayInput label="Users" source="id" reference="users" perPage={10} filter={userFilter}>
<AutocompleteArrayInput name="userIds" optionText="email" label="User(s)"  filterToQuery={queryFilter}/>
</ReferenceArrayInput>

Environment

  • React-admin version: 4.16.12
  • React version: 18.2.0
  • Browser: Chrome v122.0.6261.94
@fzaninotto
Copy link
Member

I can't reproduce this in our storybook. Would you mind building adding a repro to this issue?

@JustinHarshbarger
Copy link
Author

I will try to get something built for you to review. It might take me a bit with other priorities but hopefully I can get to it within the next few days. This issue appears like it might be visual only, but I haven't had a chance to dig into it more to verify. I just increased my page size to work around the issue for now. Thanks for the quick response, hopefully I can get back to you soon.

@fzaninotto
Copy link
Member

No news for some time, closing.

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