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.

Refresh the items in Select.Async

See original GitHub issue

I have the following Select.Async and a corresponding loadOptions function to load items.

<Select.Async loadOptions={loadOptions} 
                           value={this.state.data.my_value} 
                           onChange={this.logChange} 
                           allowCreate={true} 
                           backspaceRemoves={true} 
                           newOptionCreator={this.optionCreator} 
                        /> 

On a separate UI action, I want to reload this Select.Async items. I am looking for a function to refresh this Select options or invalidate them.

Any help is much appreciated.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:6
  • Comments:35 (3 by maintainers)

github_iconTop GitHub Comments

38reactions
MethodenManncommented, Apr 3, 2017

Ok i figured out that it worked the whole time. The problem was that i worked with a mocked fetch. Whatever i wrote into the select, my fetch returned a bunch of records. What i didn’t realize was, that the react-select has a filter that filters my loaded records with the string i entered to search. What happend is, on blur my entered text disappears and no filter was applied. Setting filterOption solved it for me in this case:

filterOption={() => (true)}

26reactions
dwickstromcommented, Jun 27, 2018

This works for me:

<Async
  key={JSON.stringify(this.state.someUpdatedProp)}
  ...
  />
Read more comments on GitHub >

github_iconTop Results From Across the Web

How trigger AsyncSelect to reload options in ReactJS
When we choose a category from the first AsyncSelect, I need to load it's sub-categories to the second one. AsyncSelect loads the items...
Read more >
Async - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.
Read more >
Asynchronous I/O (asyncio) - SQLAlchemy 1.4 Documentation
refresh () method will expire the attributes on related objects, but not necessarily refresh those related objects assuming eager loading is not ...
Read more >
Blazor DropDownList Refresh Data - Documentation - Telerik
Data = Options.ToDataSourceResult(args.Request).Data; } protected override async Task OnInitializedAsync() { Options = new List<string>() { "one", "two", ...
Read more >
Select - Examples - Components - Atlassian Design System
Use AsyncCreatableSelect to allow users to create new options asynchronously. For example, execute async calls before creating the option. What city do you...
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