Skip to content

Conversation

@visz11
Copy link
Collaborator

@visz11 visz11 commented Oct 13, 2025

🎯 Changes

Add a type to match tuple prefixes to match partial query keys in QueryFilters and MutationFilters

Fixes TanStack#9680

It's worth noting, there may be a case where it makes sense to turn QueryFilters (and MutationFilters into a discriminated union on the exact field, so that we only allow partial query filter types in the case where exact is false (or unspecified), but it's possible there are cases where one would want partial query key matching even in the exact: true case, and I'm not sure the added constraint adds much benefit. If you'd like me to add that, let me know.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 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

  • New Features

    • Improved TypeScript support for filtering queries and mutations by allowing partial key prefixes, enhancing autocomplete and type safety with no runtime changes.
  • Tests

    • Added type-level tests to validate partial key usage and ensure invalid keys are rejected by the type system.
  • Chores

    • Prepared a patch release entry to publish the fix.

tannerlinsley and others added 30 commits June 27, 2025 19:02
* chore: add typescript-eslint/require-await rule

* reflect feedback

* Update eslint.config.js

* test(angular-query-experimental): remove unnecessary async

* test(*): remove unnecessary async

* remove(query-codemods): remove unnecessary import

* chore(query-codemods): remove typescript-eslint/require-await off rule

---------

Co-authored-by: Dominik Dorfmeister <[email protected]>
Co-authored-by: Jonghyeon Ko <[email protected]>
…ack#9276)

* type(vue-query): ensure type of vue-query definition matches its implementation

* type(vue-query): update type
…ryObserver' and fix grammar in test names (TanStack#9332)

Co-authored-by: Jonghyeon Ko <[email protected]>
…r' and add 'advanceTimersByTimeAsync' (TanStack#9341)

Co-authored-by: Jonghyeon Ko <[email protected]>
…ersByTimeAsync' and replace 'findByText' with 'getByText' (TanStack#9358)

Co-authored-by: Jonghyeon Ko <[email protected]>
…replace 'waitFor' with 'vi.waitFor' (TanStack#9349)

Co-authored-by: Jonghyeon Ko <[email protected]>
…move 'waitFor' and add 'advanceTimersByTimeAsync' (TanStack#9354)

Co-authored-by: Jonghyeon Ko <[email protected]>
arnoud-dv and others added 27 commits September 16, 2025 00:07
…#9270)

* feat(angular-query-devtools): move devtools to conditional sub-paths, improves tree shaking and dependency injection

* Fix compatibility with moduleResolution node

* ci: apply automated fixes

* fix preview release for angular-query

* Fix angular-query preview release

* Revert some changes made obsolete by better Vite based alternative

* Update export paths

* Fix production exports and publishconfig

* knip config

* remove postpack

* Generate API reference docs

* type declarations in correct directory

* Update documentation

* knip config

* Optional core devtools dependency

* ci: apply automated fixes

* regenerate api reference docs

* ci: apply automated fixes

* ci: apply automated fixes (attempt 2/3)

* regenerate api reference docs

* formatting

* apply coderabbit suggestions

* Improve unit tests

* docs

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…a071bc9 (TanStack#9627)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…Stack#9615)

* feat(query-core): add context to mutationfn

Co-Authored-By: travikk <[email protected]>

* fix(query-core): mutation onSuccess scope param should also be undefined

Co-Authored-By: travikk <[email protected]>

* feat: add scope deprecate context on mutation state

* feat(query-core): add mutation context to all mutation callbacks

* chore: pr amends

Co-Authored-By: Dominik Dorfmeister <[email protected]>

* test(unit): update to handle context in mutation callbacks

* chore: rename to onMutateResult

* chore: revert context deprecation on MutationState

---------

Co-authored-by: travikk <[email protected]>
Co-authored-by: Dominik Dorfmeister <[email protected]>
Co-authored-by: Dominik Dorfmeister <[email protected]>
* fix(angular-query-experimental): typings for injectQueries should now behave properly

* fix(angular-query-experimental): behaviors of injectQuery now work at runtime

Mostly

* ci: apply automated fixes

* add signal proxy

* ci: apply automated fixes

* update @testing-library/angular

* fix build

* rename test file

* ci: apply automated fixes

* fix type error

* apply corerabbit suggestions

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Arnoud de Vries <[email protected]>
* Enhance partner logos with responsive images

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
…nStable() support (TanStack#9666)

Integrates TanStack Query for Angular with Angular's PendingTasks API to properly track
asynchronous operations, ensuring ApplicationRef.whenStable() waits for queries and
mutations to complete before resolving.

Features:
- Cross-version compatibility (Angular v16+ with graceful degradation)
- Tracks query fetchStatus and mutation isPending state
- Automatic cleanup on component destruction
- Comprehensive test coverage including edge cases

Benefits:
- Improved SSR: Server waits for data fetching before rendering
- Better testing: fixture.whenStable() properly waits for async operations
- Zoneless support: Correct change detection timing
* chore: update workspace config

* Update more deps

* Fix issues
…fd19551 (TanStack#9674)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…anStack#9634)

* test(vue-query): add type-check test for useInfiniteQuery with infiniteQueryOptions

* fix(vue-query): wrap useInfiniteQuery options in MaybeRefOrGetter

* remove type problem example

* test(vue-query): add test for plain options getter

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Damian Osipiuk <[email protected]>
…anStack#9677)

* fix(types): onMutateResult is always defined in onSuccess callback

this is guaranteed because if onMutate fails or rejects, onSuccess is never called. if onMutate is not present, the type will be unknown

* chore: fix tests
…#9668)

* fix(solid-query): add missing generic error type

* refactor(solid-query): remove unused generic type

* test(solid-query): add case for error tag

---------

Co-authored-by: Dominik Dorfmeister <[email protected]>
…tionFilters`

Add a type to match tuple prefixes to match partial query keys in `QueryFilters` and `MutationFilters`

Fixes TanStack#9680
…ilters`

add tests to verify that the new partial QueryKey matching for `QueryFilters` does match partial query keys, and also doesn't allow invalid query keys.
prevent tuple helper types from getting exported, and showing up in the public api
* ci: introduce changesets

* Avoid using changesets/action

* Remove PR permission

* Update PR template

* Update link
@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

193 files out of 300 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch clone-fix/9680-queryfilters-partial-matching

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

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @visz11, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily focuses on improving the developer experience and type safety within the @tanstack/query-core package by introducing support for partial query keys in QueryFilters and MutationFilters. This allows developers to specify query key prefixes for filtering operations, leading to enhanced TypeScript autocomplete and more precise type checking without altering any runtime logic. Additionally, the PR includes significant documentation updates across all supported frameworks to reflect recent API changes and best practices, alongside general maintenance and dependency upgrades to keep the project current.

Highlights

  • Enhanced Type Safety for Query and Mutation Filters: Introduced type-level support for partial query keys in QueryFilters and MutationFilters, allowing filtering by tuple prefixes.
  • Improved Developer Experience: This change provides better autocomplete and more robust type checking when working with query and mutation filters.
  • No Runtime Impact: The enhancement is purely type-based, ensuring no changes to runtime behavior or performance.
  • Comprehensive Documentation Updates: Extensive updates across Angular, React, Solid, and Svelte documentation, including new reference pages, corrected links, and improved examples, reflecting API changes and best practices.
  • Infrastructure and Dependency Updates: Modernized various configuration files, updated Node.js and package manager versions, and streamlined release processes using Changesets.
Ignored Files
  • Ignored by pattern: .github/workflows/** (4)
    • .github/workflows/autofix.yml
    • .github/workflows/labeler.yml
    • .github/workflows/pr.yml
    • .github/workflows/release.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a great improvement to type safety by allowing partial query keys in QueryFilters and MutationFilters. The implementation of TuplePrefix is clever and the added tests confirm the new behavior. The PR also includes a massive amount of documentation updates, dependency bumps, and refactoring across the examples and docs, which is a huge effort. My main feedback is a suggestion to further improve the type safety of filters by using a discriminated union, as you've also hinted at in the PR description.

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.

matchQuery types don't support partial keys