Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findAll should query adapter if previous query is expired. #234

Closed
antoinebrault opened this issue Oct 5, 2015 · 1 comment
Closed

findAll should query adapter if previous query is expired. #234

antoinebrault opened this issue Oct 5, 2015 · 1 comment

Comments

@antoinebrault
Copy link

Currently, if i use reap = "none", findAll() always returns cached data even if it is expired.

Similar to #154, I think there should be a way to refresh data with findAll when previous query is expired instead of refreshing on reapInterval with reap="refresh".

Maybe something along the lines of:

// force a new request
if (options.bypassCache || !options.cacheResponse) {
  delete resource.completedQueries[queryHash];
  delete resource.queryData[queryHash];
}
if (queryHash in resource.completedQueries && resource.completedQueries[queryHash] + options.maxAge >= new Date().getTime()) {
 // ...
}
}).then(function (items) {
    if (!items) {
        if (!(queryHash in resource.pendingQueries)) {
@jmdobry
Copy link
Member

jmdobry commented Oct 5, 2015

Sounds good. PR?

jmdobry added a commit that referenced this issue Oct 8, 2015
Support maxAge in find/findAll requests (Issue #234)
@jmdobry jmdobry closed this as completed Oct 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants