how to clear cache result with ASYNC
See original GitHub issuei have the following
<Async
autoload={false}
multi={false}
value={this.state.selectValue}
onChange={this.updateValue}
valueKey="value"
labelKey="label"
loadOptions={this.getCommsmatrices}
onValueClick={this.gotoCommsmatrix}
cache={false}
/>
getCommsmatrices (input, callback) {
input = input.toLowerCase();
let options = this.state.options.filter(i => {
return i.label.toLowerCase().includes(input) == true;
});
let data = {
options: options,
complete: true
};
setTimeout(function() {
callback(null, data);
}, ASYNC_DELAY);
}
once my results are loaded it stays cached. i want to trigger this cache clean externally. how can this be done?
i want to clear the cache in the following function. I have tried setting isLoading
but it does not work.
updateCommsMatrix(service_id){
this.setState({ isLoading: true });
this.updateValue(null);
if(service_id > 0){
let self = this;
this.props.fetchCommsmatricesByService(service_id)
.then( response => {
let data = response.payload.data.body.recordset.record;
let options = self.populateOptionsObject(data, 'id', 'filename');
options.unshift({ value: '0', label: 'All' });
return options;
})
.then( options => self.setState({options:options,isLoading: false}));
} else {
this.setState({ options:{ value: '0', label: 'All'},isLoading: false });
}
this.props.dispatch(change('SecurityExemptionsNewForm', 'service_id', service_id));
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Async cache clearing · Pullstate
A big part of working with asynchronous data is being able to control the cache. ... Clear the cache for specific arguments (fingerprint)....
Read more >Async/Await and Caching - Stack Overflow
Here's a way to cache results of asynchronous operations that guarantees no cache misses and is thread-safe. In the accepted answer, ...
Read more >Avoid This Mistake When Caching Asynchronous Results
Caching is hard. Caching asynchronous results is even harder. Learn how to properly cache promise results in JavaScript.
Read more >Advanced topics on caching in Apollo Client
To reset the cache without refetching active queries, use client.clearStore() instead of client.resetStore() . Responding to cache resets. You can register ...
Read more >The functools library — asyncstdlib 3.10.5 documentation
Async Caches ¶ ... The regular functools.lru_cache() and functools.cached_property() are not appropriate for async callables, such as an async def coroutine ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@JedWatson I’m using v2, please advise on how to clear the cache on this version. Thanks!
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 efforts towards the current major 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!