You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(query-core): do not schedule garbage collection on the server - #12026
On the server, scheduleGc now returns early, so no timer is scheduled even when gcTime is set explicitly (the gcTime value itself is still kept). Added a test and a patch changeset for @tanstack/query-core.
I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
I have followed the AI contribution policy and fully understand the code in this pull request, including any code generated with AI assistance.
🚀 Release Impact
This change affects published code, and I have generated a changeset.
This change is docs/CI/dev-only (no release).
Summary by CodeRabbit
Bug Fixes
Garbage collection is no longer scheduled on the server, even when an explicit garbage-collection time is set. Client-side garbage collection continues to work as before.
Reviewing files that changed from the base of the PR and between a8af0e2 and 56cc6ee.
📒 Files selected for processing: 3
.changeset/quiet-timers-rest.md
packages/query-core/src/__tests__/query.test.tsx
packages/query-core/src/removable.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Server-side query garbage collection no longer schedules a timeout when gcTime is explicitly set. A test verifies that the configured value remains set and that no timeout is scheduled.
Server-side queries retain their configured gcTime without scheduling GC timers, and the supplied test covers the explicit-value case. No actionable merge risk is evident.
Pre-merge checks: 5
Passed checks: 5 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: preventing garbage-collection scheduling on the server in query-core.
Description check
The description covers the change and motivation, references the linked issue, completes the required checklist, and records the release impact with a changeset.
Linked Issues check
Issue [#12025] requires no garbage-collection timer on the server for any gcTime value while retaining the value. Removable.scheduleGc() now clears an existing timeout and returns when `isServerEn…
Out of Scope Changes check
The changed implementation directly addresses server-side garbage-collection scheduling. The test covers the explicit gcTime case from issue [#12025]. The changeset documents the published `@tanstac…
Docstring Coverage
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Changes
On the server,
scheduleGcnow returns early, so no timer is scheduled even whengcTimeis set explicitly (thegcTimevalue itself is still kept). Added a test and a patch changeset for@tanstack/query-core.Fixes #12025
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit