Skip to content

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Nov 14, 2025

fixes #9871

Summary by CodeRabbit

  • Bug Fixes
    • Improved type safety for query key handling to preserve readonly semantics in key prefixes.
  • Tests
    • Added test coverage validating readonly-union scenarios for query filters and key matching.
  • Chores
    • Included a changeset preparing a patch release for the type fix.

@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

🦋 Changeset detected

Latest commit: f918a31

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

This PR includes changesets to release 19 packages
Name Type
@tanstack/query-core Patch
@tanstack/angular-query-experimental Patch
@tanstack/query-async-storage-persister Patch
@tanstack/query-broadcast-client-experimental Patch
@tanstack/query-persist-client-core Patch
@tanstack/query-sync-storage-persister Patch
@tanstack/react-query Patch
@tanstack/solid-query Patch
@tanstack/svelte-query Patch
@tanstack/vue-query Patch
@tanstack/angular-query-persist-client Patch
@tanstack/react-query-persist-client Patch
@tanstack/solid-query-persist-client Patch
@tanstack/svelte-query-persist-client Patch
@tanstack/react-query-devtools Patch
@tanstack/react-query-next-experimental Patch
@tanstack/solid-query-devtools Patch
@tanstack/svelte-query-devtools Patch
@tanstack/vue-query-devtools Patch

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
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Updated type-level tuple utilities to preserve readonly tuple types (by wrapping results with readonly [...]) and adjusted tests to expect readonly query key prefixes; no runtime behavior changes.

Changes

Cohort / File(s) Summary
Type utility update
packages/query-core/src/utils.ts
Modified DropLast type to return a readonly tuple (readonly [...R]) so prefix computations keep tuple immutability.
Type test updates
packages/query-core/src/__tests__/utils.test-d.tsx
Adjusted expectations to use readonly query key tuples and added a test for readonly union key scenarios producing the correct union of prefix types.
Changeset
.changeset/new-keys-raise.md
Added changeset noting a patch bump and the type fix: “do not drop readonly for partial QueryFilter matching.”

Sequence Diagram(s)

(Skipped — changes are type-only and do not change runtime control flow.)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Type-only change with small surface area.
  • Pay attention to DropLast interactions with TuplePrefixes and any other tuple utilities.
  • Review the added test covering readonly union key cases.

Possibly related PRs

Poem

🐰 I nibble at tuples, gentle and spry,
Kept readonly bits safe, I hop and I sigh.
DropLast now honors the shape of the key,
Prefixes stay steady — hooray, squeak, whee! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal but insufficient. It only references the linked issue without following the provided template structure. Provide details in the 'Changes' section explaining the fix, and confirm the checklist items have been completed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing type handling to preserve readonly modifier in QueryFilter matching.
Linked Issues check ✅ Passed The code changes address the core issue by modifying the DropLast type to preserve readonly tuples, directly fixing the partial QueryFilter matching incompatibility with readonly query keys.
Out of Scope Changes check ✅ Passed All changes are focused and in-scope: type adjustments in DropLast and corresponding test updates directly address the readonly preservation requirement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c0c797 and f918a31.

📒 Files selected for processing (1)
  • .changeset/new-keys-raise.md (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@TkDodo TkDodo marked this pull request as ready for review November 14, 2025 08:07
@nx-cloud
Copy link

nx-cloud bot commented Nov 14, 2025

View your CI Pipeline Execution ↗ for commit f918a31

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

☁️ Nx Cloud last updated this comment at 2025-11-14 08:16:00 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2025

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@9872

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 6c0c797

@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

Sizes for commit f918a31:

Branch Bundle Size
Main
This PR

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.81%. Comparing base (35deec3) to head (f918a31).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #9872       +/-   ##
===========================================
+ Coverage   45.78%   59.81%   +14.03%     
===========================================
  Files         200      129       -71     
  Lines        8413     5627     -2786     
  Branches     1929     1530      -399     
===========================================
- Hits         3852     3366      -486     
+ Misses       4113     1956     -2157     
+ Partials      448      305      -143     
Components Coverage Δ
@tanstack/angular-query-experimental 93.85% <ø> (ø)
@tanstack/eslint-plugin-query ∅ <ø> (∅)
@tanstack/query-async-storage-persister 43.85% <ø> (ø)
@tanstack/query-broadcast-client-experimental 24.39% <ø> (ø)
@tanstack/query-codemods ∅ <ø> (∅)
@tanstack/query-core 97.38% <ø> (ø)
@tanstack/query-devtools 3.48% <ø> (ø)
@tanstack/query-persist-client-core 80.00% <ø> (ø)
@tanstack/query-sync-storage-persister 84.61% <ø> (ø)
@tanstack/query-test-utils ∅ <ø> (∅)
@tanstack/react-query 96.01% <ø> (ø)
@tanstack/react-query-devtools 10.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 77.81% <ø> (ø)
@tanstack/solid-query-devtools 61.90% <ø> (ø)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query ∅ <ø> (∅)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client ∅ <ø> (∅)
@tanstack/vue-query 71.28% <ø> (ø)
@tanstack/vue-query-devtools ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TkDodo TkDodo merged commit 08b211f into main Nov 14, 2025
5 of 6 checks passed
@TkDodo TkDodo deleted the feature/9871 branch November 14, 2025 08:14
@github-actions github-actions bot mentioned this pull request Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial QueryFilter matching breaks readonly query keys

2 participants