Skip to content

Commit

Permalink
fix(core): added in timer and interval id checks before clearing (#3762)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilt authored Jul 15, 2022
1 parent 3118b7f commit 5d99f7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/core/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ export class Query<
}

private clearGcTimeout() {
clearTimeout(this.gcTimeout)
this.gcTimeout = undefined
if (this.gcTimeout) {
clearTimeout(this.gcTimeout)
this.gcTimeout = undefined
}
}

private optionalRemove() {
Expand Down
12 changes: 8 additions & 4 deletions src/core/queryObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,17 @@ export class QueryObserver<
}

private clearStaleTimeout(): void {
clearTimeout(this.staleTimeoutId)
this.staleTimeoutId = undefined
if (this.staleTimeoutId) {
clearTimeout(this.staleTimeoutId)
this.staleTimeoutId = undefined
}
}

private clearRefetchInterval(): void {
clearInterval(this.refetchIntervalId)
this.refetchIntervalId = undefined
if (this.refetchIntervalId) {
clearInterval(this.refetchIntervalId)
this.refetchIntervalId = undefined
}
}

protected createResult(
Expand Down

1 comment on commit 5d99f7e

@vercel
Copy link

@vercel vercel bot commented on 5d99f7e Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.