Skip to content

Commit

Permalink
fix: don't schedule garbage collection unnecessarily (#627)
Browse files Browse the repository at this point in the history
This doesn't actually fix the issue I'm looking into, but I did notice that this timeout is scheduled even when the query is cleared and I *think* it shouldn't be. If we do need to garbage collect something, that should happen in `clear` I think.
  • Loading branch information
kentcdodds authored Jun 24, 2020
1 parent 6922cda commit 1e1e0f6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/queryCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export function makeQueryCache({ frozen = isServer, defaultConfig } = {}) {
}

query.scheduleGarbageCollection = () => {
if (!queryCache.queries[query.queryHash]) return
if (query.config.cacheTime === Infinity) {
return
}
Expand Down

0 comments on commit 1e1e0f6

Please sign in to comment.