Skip to content

Remove predicate typing for query filters#8958

Merged
TkDodo merged 5 commits intoTanStack:mainfrom
Nick-Lucas:remove-typesafe-query-filters
Apr 14, 2025
Merged

Remove predicate typing for query filters#8958
TkDodo merged 5 commits intoTanStack:mainfrom
Nick-Lucas:remove-typesafe-query-filters

Conversation

@Nick-Lucas
Copy link
Copy Markdown
Contributor

@Nick-Lucas Nick-Lucas commented Apr 5, 2025

Fixes #8768

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 5, 2025

View your CI Pipeline Execution ↗ for commit 209af08.

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

☁️ Nx Cloud last updated this comment at 2025-04-14 08:07:03 UTC

@Nick-Lucas
Copy link
Copy Markdown
Contributor Author

So @TkDodo I'm in two minds if we should go as far as stripping out the generics entirely. It's more of a breaking change to remove them than to leave them unused, especially since the 4th type param (query key) does get used currently.

What do you think?

@TkDodo
Copy link
Copy Markdown
Collaborator

TkDodo commented Apr 5, 2025

TypeScript errors on unused type parameters:

src/utils.ts(19,3): error TS6133: 'TError' is declared but its value is never read.
src/utils.ts(20,3): error TS6133: 'TData' is declared but its value is never read.

so what option do we have other than deleting them?

@Nick-Lucas
Copy link
Copy Markdown
Contributor Author

Should be possible to ignore the warnings I think? So it's more a question of where your mind is at as a maintainer

I didn't do anything today beyond start this draft, there will be tests failing as well that I can sort out either way

@TkDodo
Copy link
Copy Markdown
Collaborator

TkDodo commented Apr 5, 2025

Should be possible to ignore the warnings I think?

this isn’t just an eslint warning - it’s a TS error that you would need to silence with ts-ignore, which is not something I’d recommend because if the comments get stripped, the error might resurface

@Nick-Lucas Nick-Lucas force-pushed the remove-typesafe-query-filters branch from 84eb7d3 to 8064c84 Compare April 13, 2025 12:56
@Nick-Lucas Nick-Lucas changed the title Remove prdicate typing for query filters Remove predicate typing for query filters Apr 13, 2025
@Nick-Lucas Nick-Lucas marked this pull request as ready for review April 13, 2025 12:58
@Nick-Lucas
Copy link
Copy Markdown
Contributor Author

Hey @TkDodo I've stripped this out everywhere, might need synchronising with tRPC as I think we made some changes to support these generics but that should be quick

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 13, 2025

More templates

@tanstack/angular-query-devtools-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/angular-query-experimental

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 209af08

@Nick-Lucas
Copy link
Copy Markdown
Contributor Author

Nick-Lucas commented Apr 13, 2025

failing test seems to be flake rather than anything I've done, could use a retry

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 59.01%. Comparing base (5d12a32) to head (209af08).
Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #8958       +/-   ##
===========================================
+ Coverage   44.47%   59.01%   +14.54%     
===========================================
  Files         203      138       -65     
  Lines        8104     5358     -2746     
  Branches     1804     1424      -380     
===========================================
- Hits         3604     3162      -442     
+ Misses       4066     1907     -2159     
+ Partials      434      289      -145     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental 85.23% <ø> (ø)
@tanstack/eslint-plugin-query ∅ <ø> (∅)
@tanstack/query-async-storage-persister 43.85% <ø> (ø)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods ∅ <ø> (∅)
@tanstack/query-core 95.95% <100.00%> (+0.47%) ⬆️
@tanstack/query-devtools 3.61% <ø> (ø)
@tanstack/query-persist-client-core 73.46% <ø> (ø)
@tanstack/query-sync-storage-persister 84.61% <ø> (ø)
@tanstack/react-query 95.42% <ø> (ø)
@tanstack/react-query-devtools 10.00% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query 78.48% <ø> (ø)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client 100.00% <ø> (ø)
@tanstack/svelte-query 88.15% <ø> (ø)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client 100.00% <ø> (ø)
@tanstack/vue-query 71.01% <50.00%> (ø)
@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 f580d4d into TanStack:main Apr 14, 2025
7 checks passed
juliusmarminge added a commit to trpc/trpc that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes #6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-formdata that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-big-router that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-minimal-react that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-app-dir that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-minimal-starter that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-prisma-websockets-starter that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-prisma-starter that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
trpc-bot pushed a commit to trpc/examples-next-prisma-todomvc that referenced this pull request Apr 29, 2025
Affected by TanStack/query#8958

Closes trpc/trpc#6730

## 🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

<!--
Note: once you create a Pull request, we will automatically fix
auto-fixable lint issues in your branch
-->

## ✅ Checklist

- [ ] I have followed the steps listed in the [Contributing
guide](https://github.com/trpc/trpc/blob/main/CONTRIBUTING.md).
- [ ] If necessary, I have added documentation related to the changes
made.
- [ ] I have added or updated the tests related to the changes made.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Refactor**
- Streamlined internal query filtering methods by simplifying filter
type parameters, improving usability and clarity.

- **Chores**
- Upgraded the core query library dependency across the project and
examples to version `^5.74.7`, enhancing performance, stability, and
access to the latest features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: juliusmarminge <jmarminge@gmail.com>
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.

invalidateQueries predicate option: queryKey property is typed too strictly

2 participants