It would be nice if we could specify a time delay to wait after the last keystroke before calling asyncOptions, so it doesn't make unnecessary requests.
Bump, as far as I can see asyncOptions are fired on change, is it possible to fire it when user stops typing?
It's implemented in my branch https://github.com/JedWatson/react-select/pull/473 @PSkierniewski
@oliversong Thx I used it and it works.
@oliversong i need this too. Can you check the PR for this feature to fix it so it can be merged?
For those who might need, for now you can have debouncing by wrapping your loadOptions callback by lodash/debounce
const wait = 500; // milliseconds
const loadOptions = input => dataStore.getData(input)
const debouncedLoadOptions = _.debounce(loadOptions, wait)
return <Async loadOptions={debouncedLoadOptions} ... />
It looks like @JedWatson has expressed that this be left for users to implement in the function that's passed to loadOptions.
For those doing so, Lodash's debounce function is not suited for this. Instead, a promise-returning debounce method where subsequent calls return promises which will resolve to the result of the next func invocation in needed. See https://github.com/JedWatson/react-select/issues/3075#issuecomment-450194917
Most helpful comment
For those who might need, for now you can have debouncing by wrapping your loadOptions callback by lodash/debounce