Skip to content

Commit

Permalink
fix(refetchOnWindowFocus): stale queries are no longer refetched
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jun 24, 2020
1 parent f844de8 commit c3e42c4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/setFocusHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ const onWindowFocus = () => {
return false
}

if (!query.config.enabled) {
if (!query.instances.some(instance => instance.config.enabled)) {
return false
}

if (!query.state.isStale) {
return false
}

if (query.shouldContinueRetryOnFocus) {
// delete promise, so refetching will create new one
delete query.promise
return true
}

return query.config.refetchOnWindowFocus
Expand Down

0 comments on commit c3e42c4

Please sign in to comment.