Skip to content
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

Migrate to TanStack Query v5 #415

Open
iamyuu opened this issue Oct 19, 2023 · 8 comments
Open

Migrate to TanStack Query v5 #415

iamyuu opened this issue Oct 19, 2023 · 8 comments

Comments

@iamyuu
Copy link

iamyuu commented Oct 19, 2023

Read the announcement post here: https://tanstack.com/blog/announcing-tanstack-query-v5
Read the migration guide here: https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5

@techgerm
Copy link

This would be awesome! 🚀

@Talent30
Copy link

Hi, @iamyuu @techgerm. I am trying to migrate it. Please join discord if you would like to help.

@michaelangeloio
Copy link
Contributor

One caveat to this: All of our packages are currently in sync. We'd have to break this convention to not let others be forced to upgrade (should they want the latest @ts-rest/core package, for instance).

If the community is OK with upgrading to react-query v5, I'm also cool with it, so as long as we properly communicate @ts-rest/vX will force you to upgrade react query.

@PontusAxelsson
Copy link

It is peerDependency to "@tanstack/react-query": "^4.0.0", would be good if it could handle both like:
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"@tanstack/react-query": "^4.0.0" || "^5.0.0",
"zod": "^3.22.3"
},

@mxmnci
Copy link

mxmnci commented Dec 7, 2023

+1 on this one!

@AdhamMoussa
Copy link

+1

@fruchtzwerg
Copy link
Contributor

fruchtzwerg commented Dec 26, 2023

I suggest to do this incrementally. v4 already supports object syntax for query options (1st item in the migration guide):
https://github.com/ts-rest/ts-rest/blob/main/libs/ts-rest/react-query/src/lib/react-query.ts#L91

- useQuery(queryKey, dataFn, options)
+ useQuery({ queryKey, queryFn, ...options })

This could be done under the hood as a non-breaking change, thus supporting v4 and v5 as a peer dependency. I would imagine that this fixes 90% of use-cases.

I implemented vue-query in this manner and have been using it with v5 without issue.

@rjay98
Copy link

rjay98 commented May 28, 2024

@Gabrola, we're using ts-rest in production and loving it - thank you all for maintaining & developing this!

Wanted to flag that react-query v5 is definitely a top priority for us, mostly as a way to start incorporating some of the new features (e.g., TanStack/query#7481) which has powerful new tools for promise handling between client/server components.

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

No branches or pull requests

9 participants