question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:17
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
frankie-ugcommented, Apr 6, 2018

Still getting the same issues in v1.2.1

2reactions
james-gardnercommented, Feb 16, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

alexmattson-react-select - npm package - Snyk
New version 1.0.0-rc. I've nearly completed a major rewrite of this component (see issue #568 for details and progress). The new code ...
Read more >
React-Select Async loadOptions is not loading options properly
So i am posting my update portion of code that fix the issue. Converting from async-await to normal callback function fix my issue....
Read more >
Async - React Select
Use the Async component to load options from a remote source as the user types. ... The loadOptions prop allows users to either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found