Repository navigation
fix(query-core): keep garbage collecting an unobserved query after it is reset - #12712
mgarcia-improving wants to merge 1 commit into
Conversation
… is reset Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 970196b The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🎯 Changes
Refs #12561. The main fix for that issue already landed in #12683; this covers one remaining case from the issue's expected behavior ("reset/refetch ... should still be collected normally").
Query.reset()callsdestroy(), which clears the GC timeout, but the query stays in the cache. For an unobserved query nothing reschedules GC (only a refetch of an active query would), so it stayed in the cache with no timer, even thoughgcTimeis finite.reset()now schedules GC again when the query has no observers and is still in the cache.cacheGc.test.tsx. It fails onmainand passes with this change.Tests: the full
query-coresuite passes (1659 tests) viavitestin the package. I did not runpnpm run test:pr.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit