Skip to content

feat(query-core)!: use the last applied gcTime - #12765

Merged
TkDodo merged 2 commits into
query-v6from
tkdodo/simplify-gctime-pr
Dec 5, 2026
Merged

TkDodo merged 2 commits into
query-v6from
tkdodo/simplify-gctime-pr

Conversation

@TkDodo

@TkDodo TkDodo commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

🎯 Changes

A query or mutation keeps the longest gcTime it has seen. A long value cannot be shortened, and Infinity stays forever. With this PR, the gcTime from the options that were applied last wins, like the other query-level options. See the v6 roadmap comment. This is the alternative to #12680.

  • Removable.updateGcTime takes the value from the latest options and no longer keeps the maximum. query.gcTime and mutation.gcTime stay.
  • The devtools no longer pass gcTime: -1 for "Trigger Loading". The old rule ignored that value. With the new rule it would become the active gcTime.

Options without a gcTime set it back to the default of five minutes. So a queryClient.query() call without gcTime replaces the gcTime of a mounted observer until that observer renders again. This PR leaves that as it is. Use the same gcTime wherever a query is used, for example with shared queryOptions.

Verification:

  • The 5 new or changed tests fail with the old rule and pass with the change.
  • test:lib passes for all 26 packages. test:types and test:oxlint pass for query-core and query-devtools. The full pnpm run test:pr was not run locally.
  • Size limit from a local build (size-limit default compression): react full 12,695 B → 12,690 B (−5 B, −0.04%), react minimal 8,379 B → 8,376 B (−3 B, −0.04%). The Preview CI comparison is pending.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • 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).

🤖 Generated with Claude Code

A query or mutation kept the longest `gcTime` it had seen. A long value
could not be shortened, and `Infinity` stayed forever. `updateGcTime`
now takes the value from the latest options, like the other query-level
options.

The devtools passed `gcTime: -1` for "Trigger Loading". The old rule
ignored that value. With the new rule it would become the active
`gcTime`, so the devtools no longer pass it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca1659c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@tanstack/query-core Major
@tanstack/query-devtools Major
@tanstack/angular-query Major
@tanstack/lit-query Patch
@tanstack/preact-query Major
@tanstack/query-async-storage-persister Major
@tanstack/query-broadcast-client-experimental Major
@tanstack/query-persist-client-core Major
@tanstack/react-query Major
@tanstack/solid-query Major
@tanstack/svelte-query Patch
@tanstack/vue-query Major
@tanstack/angular-query-devtools Major
@tanstack/preact-query-devtools Major
@tanstack/react-query-devtools Major
@tanstack/solid-query-devtools Major
@tanstack/svelte-query-devtools Patch
@tanstack/vue-query-devtools Patch
@tanstack/angular-query-persist-client Major
@tanstack/preact-query-persist-client Major
@tanstack/react-query-persist-client Major
@tanstack/solid-query-persist-client Major
@tanstack/svelte-query-persist-client Patch
@tanstack/react-query-next-experimental Major
@tanstack/eslint-plugin-query Major

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

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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.

Share

@nx-cloud

nx-cloud Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit ca1659c

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 5m 11s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 35s View ↗

☁️ Nx Cloud last updated this comment at 2026-12-05 14:40:58 UTC

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

23 package(s) bumped directly, 2 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/angular-query 5.108.4 → 6.0.0 Changeset
@tanstack/angular-query-devtools 5.108.4 → 6.0.0 Changeset
@tanstack/eslint-plugin-query 5.108.4 → 6.0.0 Changeset
@tanstack/lit-query 0.2.44 → 1.0.0 Changeset
@tanstack/preact-query 5.108.4 → 6.0.0 Changeset
@tanstack/preact-query-devtools 5.108.4 → 6.0.0 Changeset
@tanstack/preact-query-persist-client 5.108.4 → 6.0.0 Changeset
@tanstack/query-async-storage-persister 5.108.4 → 6.0.0 Changeset
@tanstack/query-broadcast-client-experimental 5.108.4 → 6.0.0 Changeset
@tanstack/query-core 5.108.4 → 6.0.0 Changeset
@tanstack/query-devtools 5.108.4 → 6.0.0 Changeset
@tanstack/query-persist-client-core 5.108.4 → 6.0.0 Changeset
@tanstack/react-query 5.108.4 → 6.0.0 Changeset
@tanstack/react-query-devtools 5.108.4 → 6.0.0 Changeset
@tanstack/react-query-next-experimental 5.108.4 → 6.0.0 Changeset
@tanstack/react-query-persist-client 5.108.4 → 6.0.0 Changeset
@tanstack/solid-query 5.108.4 → 6.0.0 Changeset
@tanstack/solid-query-devtools 5.108.4 → 6.0.0 Changeset
@tanstack/solid-query-persist-client 5.108.4 → 6.0.0 Changeset
@tanstack/svelte-query 6.4.7 → 7.0.0 Changeset
@tanstack/svelte-query-devtools 6.4.7 → 7.0.0 Changeset
@tanstack/vue-query 5.108.4 → 6.0.0 Changeset
@tanstack/vue-query-devtools 6.4.7 → 7.0.0 Changeset
@tanstack/angular-query-persist-client 5.108.4 → 6.0.0 Dependent
@tanstack/svelte-query-persist-client 6.4.7 → 7.0.0 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
More templates

@tanstack/angular-query

npm i https://pkg.pr.new/@tanstack/angular-query@12765

@tanstack/angular-query-devtools

npm i https://pkg.pr.new/@tanstack/angular-query-devtools@12765

@tanstack/angular-query-persist-client

npm i https://pkg.pr.new/@tanstack/angular-query-persist-client@12765

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@12765

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@12765

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@12765

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@12765

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@12765

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@12765

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@12765

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@12765

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@12765

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@12765

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@12765

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@12765

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@12765

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@12765

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@12765

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@12765

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@12765

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@12765

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@12765

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@12765

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@12765

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@12765

commit: ca1659c

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.42 KB (-0.11% 🔽)
react minimal 8.17 KB (-0.1% 🔽)

@TkDodo
TkDodo marked this pull request as ready for review December 5, 2026 14:36
@TkDodo
TkDodo merged commit 67d5607 into query-v6 Dec 5, 2026
9 checks passed
@TkDodo
TkDodo deleted the tkdodo/simplify-gctime-pr branch December 5, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant