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.

AutoComplete: Async loading of options fail first render.

See original GitHub issue

Version

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

  1. Start with dataSource = []
  2. When user enters one character search text, do async request for results to server. (Simulated by setTimeout in the codepen)
  3. 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:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
RaoHaicommented, Apr 5, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

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