React-select: complete:true is not working in loadOptions callback in 1.0.0-rc.2

Created on 30 Jan 2017  路  10Comments  路  Source: JedWatson/react-select

I am returning loadoptions callback with complete: true still it will call loadoptions function again on typing in textbox

loadOptions(input, callback) {
        const {AbInstance, filter } = this.props;
        return getDataFromServer({ AbInstance, filter }).then((response) => {
            callback(null, {
                options: response,
                complete: true
            });
        }, (error) => {
            callback(error, null);
        });
}

<Select.Async value={value} clearable={clearable} disabled={disabled} onChange={onChange} valueKey={valueKey} labelKey={labelKey} loadOptions={loadOptions} backspaceRemoves={backspaceRemoves} autoload={true} searchable={true} noResultsText={noResultsText} placeholder={selectPlaceholder} searchPromptText={searchPromptText} autofocus={autofocus} />

autoload is true so when select load first time it will call loadOptions function, and my loadOptions function taking all data from server and returning in callback with options and complete : true.

Still when ever i search in textbox it will calling loadOptions function again, i thing it should return data from cached result instead of calling loadOptions function again

Any idea, i am using 1.0.0-rc.2

Most helpful comment

Still getting the same issues in v1.2.1

All 10 comments

Not working for me either on 1.0.0-rc.3. Best to look at the source code and see if this is even still implemented. I can't see any reference to it so far.

Yes, bothers me as well. I made a search by "complete" substring through whole repository and there's indeed nothing related. Anybody know if this feature coming anytime soon?

Same issue here on 1.0.0-rc.3, loadOptions is ran multiple times despite complete: true

@JedWatson any idea of when will this get fixed? I mean the complete: true will actually work? I'm suffering this issue in a project in production, having to call the endpoint everytime the user types anything in the input.

I've just tested it in RC 4 and the issue is still there.

Thanks!

RC 5 still have this issue :(

One of the workaround would be to implement your own way of caching.

What I did is to store the fetched options into an object and when loadOptions is called, I just have a promise object return the local object instead of fetching from the API.

Works fine but I hope I can simply using complete: true

I have the same issue with v1.1.0. Is this still broken?

There were major changes in Async.js between v1.0.0-beta14 and the next tagged version, v1.0.0-rc.3, in which all references to complete were removed. Odd to see such a big change going from beta to RC.

Was this ever fixed? I have the same issue persisting with v1.2.1.

Still getting the same issues in v1.2.1

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.

If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

batusai513 picture batusai513  路  3Comments

mjuopperi picture mjuopperi  路  3Comments

MindRave picture MindRave  路  3Comments

pablote picture pablote  路  3Comments

pashap picture pashap  路  3Comments