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

AutocompleteArrayInput doesn't allow more than 25 elements

Open joobacca opened this issue 3 years ago • 3 comments

What you were expecting: ReferenceArrayInput/AutocompleteArrayInput allow the usage of an unlimited amount of elements.

What happened instead: When trying to add a new element (26th element and upwards), as soon as the GET request for the fetching of filtered options starts, my input flickers weirdly, shows as if I had confirmed the option and then disappears again.

There seems to be a limit of 25 elements only when typing in and searching. When you click on the AutocompleteArrayInput (to get a list of the current options) and click on one of the options manually, adding seems to work fine.

AutocompleteArrayInput bug

Please note that after the first input of "Algeria", I did not press enter or anything to prompt; as soon as the GET request got going with my input (after the threshold of 250ms) the flickering starts, the option I intended to use shows as if I had clicked or pressed enter, and then disappears.

Steps to reproduce:

  1. Have a ReferenceArrayInput with AutocompleteArrayInput
  2. Fill your AutocompleteArrayInput with 25 elements
  3. Try to add more by typing in (NOT by clicking into the AutocompleteArrayInput and then clicking one of the options)

Related code: Sadly, I was not able to reproduce the bug in the codesandbox, out of two reasons:

  1. The AutocompleteArrayInput in the example codesandbox (v4) doesn't allow typing inside the input, as the CreateTag component in the TagReferenceInput.tsx seems to have a bug (probably Line 88; value={value} while the value isn't a string, but an object)
  2. The fake backend (ra-data-fakerest) somehow doesn't allow filtering using fuzzy search, I wasn't able to find out why.

Other information: Setting the perPage prop on ReferenceArrayInput did not help. For now, I am using the SelectArrayInput as workaround.

Environment

  • React-admin version: 4.2.4
  • React version: 18.2.0
  • Browser: Chrome Version 103.0.5060.114

joobacca avatar Jul 25 '22 08:07 joobacca

~~Reproduced!~~

Thank for the report.

I might have spoken too fast, here is a codesandbox in which I am unable to reproduce this behaviour. Can you see it there?

antoinefricker avatar Jul 25 '22 09:07 antoinefricker

@septentrion-730n Hi! I couldn't reproduce the bug with your approach, but as I mentioned above, I think it's related to the GET requests being made when the user has changed (or started) his input, so you would need to add a ReferenceArrayInput component as well. I slightly adjusted your example with a fork, still unable to reproduce the bug, although the AutocompleteArrayInput kind of behaves weirdly.

I think the bug might not be reproducible because the ra-data-fakerest provider does not issue any HTTP requests, as the README states. I'm using ra-data-simple-rest to connect the app to the API.

joobacca avatar Jul 25 '22 13:07 joobacca

This could be related to this issue #8032

gengue avatar Aug 03 '22 18:08 gengue

No news for some time, closing.

fzaninotto avatar Oct 26 '22 14:10 fzaninotto