react-typeahead
react-typeahead copied to clipboard
Option search is being run one change behind
When 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.
Also having this issue.
This seems to work fine on tokenizer though.
I'm experiencing this as well
I was experiencing this until i removed defaultValue=""
from the component props.
@fmoo Is there any chance you could take a look at the above PR which fixes this issue?