I have a huge amount of suggestions (10,000) and would like to fix the lag issue. Im thinking having a minlength of 3 char before any suggestions are rendered would solve the issue.
THANKS!!!
Hello @wreynolds5
you can use this option
https://github.com/moroshko/react-autosuggest#should-render-suggestions-prop
If an easier option is needed, eg in inputProps, please assign this task to me.
I will be happy to help ;-)
Thanks! It would be much easier if it was an inputProp, like "minLength = 3". Is that something that you could implement? It would be much appreciated!!
I wanted to ask also other devs here for their opinion, if it's useful or not.
@moroshko what do you think?
I cant get shouldRenderSuggestions function to be called. I have pasted the component the shouldRenderSuggestions flag and have the function present but its doesnt get called when i focus on the input
Can you post your code?
Here is a simpler version----
shouldRenderSuggestions(value) {
console.log("pizzza");
return value.trim().length > 2;
}
render(){
return(
<h3 id="title">Factor Network</h3>
<Select
className='react-select-container2'
placeholder='Select Source'
options={source_options}
onChange={this.update_autocomplete}
/>
<Select
value={selectedOption}
onChange={this.handleChange}
options={this.state.factors}
isMulti
className='react-select-container'
placeholder='Select Factors'
shouldRenderSuggestions={this.shouldRenderSuggestions}
/>
)};
Do you mean something like this?
https://codepen.io/fantonangeli/pen/qBBvGzW
In this case it works. You can edit the codepen to show us an example
Thanks, @fantonangeli - here's a fork of your codepen for React 16 - https://codepen.io/bburns/pen/QWwebEp
Most helpful comment
Thanks, @fantonangeli - here's a fork of your codepen for React 16 - https://codepen.io/bburns/pen/QWwebEp