ReferenceArrayInput with AutocompleteArrayInput clearing input
See original GitHub issueI wanted to create AutocompleteArrayInput within ReferenceArrayInput,
What you were expecting:
I expected to be able to choose from the list elements just fine.
What happened instead:
Whenever I start typing in the autocompleteArrayInput, when there is more than one item already selected, the choice list gets updated, then the value I have written into the input gets cleared, and the suggestion list gets updated again. It makes it almost impossible to use the form.

Steps to reproduce:
I am using react-admin-firebase (not sure if that’s important). I created a form with an input:
<ReferenceArrayInput
source="qualifyingTasks"
reference="Tasks"
>
<AutocompleteArrayInput
filterToQuery={(q) => ({name: q})}
optionText={(record) => record.name}
/>
</ReferenceArrayInput>
It seems to be enough to reproduce the issue. Just keep adding tasks to the form and eventualy it will end up clearing the typed text.
Can’t seem to be able to reproduce the issue using the ra-data-fakerest, It might be related to react-admin-firebase library somehow.
Environment
- React-admin version: 4.3.3
- Last version that did not exhibit the issue (if applicable): -
- React version: 17.0.2
- Browser: Chrome
- Stack trace (in case of a JS error): -
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:13 (7 by maintainers)

Top Related StackOverflow Question
I seem to have managed to mitigate the issue by setting
clearOnBluroption to false. Now the question is why does this happen exactly?Btw @magicxor , you might be interested in this PR if you are looking for a way to add lifecycle callbacks to your dataProvider 😉