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.

No result found doesn't show when loadOptions returns null in Async

See original GitHub issue

What value to return or function to be invoked when the loadOptions doesn’t return any data. Right now it shows “Type to search”.

Example I got the the function below:

getOptions(input, callback) {
        var select2options = {
            options: [],            
        }
        Actions.getDevelopers(input,function(err, options){
            if (err) {
                // throw an error here
            }                  
            if (options) {                
                // loop through
                _.forEach(options.data, function(option){
                    select2options.options.push({
                        value: option._id,
                        label: option.name
                    });
                })
                select2options.complete = true;
                // call the callback
                callback(null,select2options);                
            }
           // no result found what to do here to invoke "No result found"?
        });
    }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
vhejdacommented, Oct 30, 2017

I had the same issue. Made it working with explicitly setting noResultsText prop. I am returning empty array from loadOptions callback when zero results found though, not null. Haven’t tested with null.

0reactions
bladeycommented, May 28, 2020

Hello -

In an effort to sustain the react-select project going forward, we’re closing old issues.

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 aren’t using the latest version of react-select please consider upgrading to see if it resolves any issues you’re having.

However, if you feel this issue 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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async not displaying results - Stack Overflow
I want to display "name" values as I type, but on every type it needs to send a new request with getData function....
Read more >
API - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.
Read more >
Vue-Treeselect
If no options have been initially registered ( options: null ), vue-treeselect will attempt to load root options by calling loadOptions({ action, callback, ......
Read more >
react-select-async-paginate | Yarn - Package Manager
null by default. ... It similar to loadOptions from Select.Async but there is some differences: Loaded options as 2nd argument. Additional data as...
Read more >
babel/core
In Babel 6, this method was synchronous and transformSync did not exist. ... always returns a result when a file is ignored, rather...
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