Option search is being run one change behind
See original GitHub issueWhen constructing a Typeahead with an array of strings as the object, each change brings up a list of options reflecting the input node’s value before the change.
'' > no list
'a' > empty list
'ab' > list matching 'a'
'abc' > list matching 'ab'
'ab' [backspace] > list matching 'abc'
'abPASTED_TEXT' > list matching 'ab'
'abPASTED_TEXTc' > list matching 'abPASTED_TEXT'
Based on stepping through, it seems to be because componentWillReceiveProps
is using this.state.entryValue
to calculate the options, but the setState({entryValue})
in _onTextEntryUpdated
hasn’t yet been put into this.state
at that point. As a result, even though the correct options are calculated in _onTextEntryUpdated
, they’re instantly overridden before the render occurs by a recalculation in componentWillReceiveProps
using the previous state.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
React form onChange->setState one step behind
A call to setState isn't synchronous. It creates a "pending state transition." (See here for more details). You should explicitly pass the new...
Read more >Change settings for the Search Results Web Part
Learn how to change the query and other settings to display search results in the SharePoint Search Results Web Part.
Read more >Change your VoiceOver settings on iPhone
To set other audio options, go to Settings > Accessibility > VoiceOver > Audio, then set options such as the following: Sounds &...
Read more >Change site permissions - Computer - Google Chrome Help
On your computer, open Chrome. At the top right, click More More and then Settings. Click Privacy and security and then Site settings....
Read more >The changing categories the U.S. census has used to ...
And it was not until 2000 that Americans could choose more than one race to describe themselves, allowing for an estimate of the...
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
@fmoo Is there any chance you could take a look at the above PR which fixes this issue?
I was experiencing this until i removed
defaultValue=""
from the component props.