Skip to content

Remove predicate typing for query filters #8958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 14, 2025

Conversation

Nick-Lucas
Copy link
Contributor

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

Fixes #8768

Copy link

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
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
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
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
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
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

Copy link

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
Contributor Author

Nick-Lucas commented Apr 13, 2025

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

Copy link

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
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