react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

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

Open JustinHarshbarger opened this issue 1 year ago • 2 comments

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

JustinHarshbarger avatar Mar 12 '24 05:03 JustinHarshbarger

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

fzaninotto avatar Mar 12 '24 13:03 fzaninotto

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.

JustinHarshbarger avatar Mar 13 '24 05:03 JustinHarshbarger

No news for some time, closing.

fzaninotto avatar May 03 '24 21:05 fzaninotto