question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ReferenceArrayInput with AutocompleteArrayInput clearing input

See original GitHub issue

I 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. flickering

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:closed
  • Created a year ago
  • Reactions:2
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
KonkretneKosteczkicommented, Sep 22, 2022

I seem to have managed to mitigate the issue by setting clearOnBlur option to false. Now the question is why does this happen exactly?

1reaction
slax57commented, Dec 19, 2022

Btw @magicxor , you might be interested in this PR if you are looking for a way to add lifecycle callbacks to your dataProvider 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

The AutocompleteArrayInput Component - React-admin
When used inside a <ReferenceArrayInput> , whenever users type a string in the autocomplete input, <AutocompleteArrayInput> calls dataProvider.getList() using ...
Read more >
How can i fix React admin reference input problem?
You are using a AutocompleteArrayInput inside a ReferenceInput . Try using a AutocompleteArrayInput inside a ReferenceArrayInput .
Read more >
Source - GitHub
... Fix `<AutocompleteInput>` doesn't allow clearing the inputs in certain ... Fix `<ReferenceArrayInput>` with `<AutocompleteArrayInput>` throws error if ...
Read more >
marmelab - Bountysource
I wanted to create AutocompleteArrayInput within ReferenceArrayInput, ... written into the input gets cleared, and the suggestion list gets updated again.
Read more >
How to Clear Input Values of Dynamic Form in React
There's a lot to consider when working on a React application, especially when they involve forms. Even if you're able to create a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found