react-select icon indicating copy to clipboard operation
react-select copied to clipboard

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

Open jariwalabhavesh opened this issue 9 years ago • 10 comments

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

jariwalabhavesh avatar Jan 30 '17 13:01 jariwalabhavesh

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.

james-gardner avatar Feb 16 '17 12:02 james-gardner

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?

shlajin avatar Mar 04 '17 16:03 shlajin

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

Rauttis avatar Mar 13 '17 14:03 Rauttis

@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!

gazpachu avatar May 16 '17 14:05 gazpachu

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

kinyat avatar Jul 18 '17 00:07 kinyat

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

juancarlosfarah avatar Dec 15 '17 23:12 juancarlosfarah

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.

techrah avatar Dec 16 '17 15:12 techrah

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

cclarks avatar Mar 07 '18 15:03 cclarks

Still getting the same issues in v1.2.1

frankie-ug avatar Apr 06 '18 10:04 frankie-ug

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.

bladey avatar May 27 '20 06:05 bladey