Async component update options in weird way
See original GitHub issueonChange method
onChange(selected) {
this.setState({ selected });
}
load more options - data.data
contains proper array
loadOptions(query, callback) {
Axios.get('/suggestions', { params: { query } })
.then(({ data }) => ({ options: data.data }))
.then(suggestions => callback(null, suggestions));
}
Async component
<Select.Async
multi
autoload
cache={false}
ignoreAccents={false}
ignoreCase={false}
value={selected}
clearable={false}
loadOptions={this.loadOptions}
onChange={this.onChange}
valueRenderer={d => <SuggestionOption data={d} />}
optionRenderer={d => <SuggestionOption data={d} />}
/>
I typed first two letters and i’m getting results
i typed another one and results gone
moreover sometimes results are not showing at all, even REST api return array with suggestions
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
React-Select Async loadOptions is not loading options properly
I try to use SearchableSelect as an independent component, if i need some back-end action to do this function will trigger that accordingly....
Read more >Configuration options - React Async
Watches this property through componentDidUpdate and re-runs the promiseFn when the value changes, using a simple reference check ( oldValue !== newValue )....
Read more >How To Handle Async Data Loading, Lazy Loading, and Code ...
When you unmount, the component useEffect updates the variable. The asynchronous function will still resolve, but it won't make any changes to ...
Read more >Update on Async Rendering – React Blog
Sometimes people use componentWillUpdate out of a misplaced fear that by the time componentDidUpdate fires, it is “too late” to update the state ......
Read more >Async/Await - Best Practices in Asynchronous Programming
Avoid Async Void; Async All the Way; Configure Context; Know Your Tools ... invoking an event handler that returns a type is very...
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
I got it to work with
filterOptions={options => options}
.+1 for this still being an issue