Skip to content

Commit

Permalink
fix(retries): cancel retry timer when query is cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jun 22, 2020
1 parent 8eec19a commit 9c618f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/queryCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export function makeQueryCache({ frozen = isServer, defaultConfig } = {}) {
query.clear = () => {
clearTimeout(query.staleTimeout)
clearTimeout(query.cacheTimeout)
clearTimeout(query.retryTimeout)
query.clearIntervals()
query.cancel()
query.dispatch = noop
Expand Down Expand Up @@ -500,7 +501,7 @@ export function makeQueryCache({ frozen = isServer, defaultConfig } = {}) {
// Return a new promise with the retry
return await new Promise((resolve, reject) => {
// Keep track of the retry timeout
setTimeout(async () => {
query.retryTimeout = setTimeout(async () => {
if (query.cancelled) return reject(query.cancelled)

try {
Expand Down

0 comments on commit 9c618f3

Please sign in to comment.