AutoComplete: Async loading of options fail first render.
See original GitHub issueVersion
2.8.3
Environment
Any
Reproduction link
http://codepen.io/JesperWe/pen/XMOzqP
(Type ‘res’ slooowly in the input field. Notice first menu item does not appear until second character typed.)
Steps to reproduce
- Start with
dataSource = []
- When user enters one character search text, do async request for results to server. (Simulated by
setTimeout
in the codepen) - When result arrives, update AutoComplete dataSource.
What is expected?
Menu to pop up with option from first async server result.
What is actually happening?
Menu is not appearing until dataSource has been updated 2 times (after request made on second character returns). After second update each new async result updates the menu as expected.
This issue is only present when using async loading and on the first update of dataSource from []
to [...some options...]
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Issue with async default value in React Material UI ...
I am using 'Material UI' Autocomplete component to render a dropdown in my form. However, in case the user wants to edit an...
Read more >AutoComplete Async Loading - JavaScript Wijmo Demos
The AutoComplete control can load items asysnchronously in the dropdown menu as the input changes. This is useful when the number of items...
Read more >Async
Use the Async component to load options from a remote source as the user types. import Async, { useAsync } from 'react-select/async'; ...
Read more >react-select-async-paginate
Async function that take next arguments: Current value of search input. Loaded options for current search. Collected additional data e.g. ...
Read more >Field
Async : return a Promise that resolves a string containing the error message. This works like Formik's validate , but instead of returning...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
both merged will fix this bug…
Thanks @JesperWe.
This bug happened because of this equation:
https://github.com/react-component/select/blob/master/src/Select.jsx#L695
a customised input element, defaultly in antd, an
<Antd.Input />
, will always not equals activeElement of document.