-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: add vue-query #65
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Looking into this. Thanks! |
Hi @ozum, Nice work on this pr. I was playing around with it and I was having trouble using optimistic updates on mutations. This is how I had it setup. Doesn't seem like the onMutate hook is called. Any idea why this doesn't work?
|
@kylegl, since I'm unfamiliar with tRPC and vue-query, I cannot help yet. I developed this PR as a starting point if @wobsoriano wants to implement vue-query. IMHO, currently, it seems best to use vue-query manually with trpc-nuxt. I need a clarification from @wobsoriano at #66, on how to use $fetch, so it can be used manually until vue-qery support is implemented. Also, we should ask for general tan-stack query (vue-query) support in the tRPC itself because it is the most appropriate place to implement it. See issue and request here. |
With the risk of necroing this, are there any plans to merge this? It looks promising to me, and I would for sure love to work with Tanstack Query in Vueland. |
Sorry to hijack this thread but I've just released a new package that aims to be the integration you're looking for. It can be found here: https://github.com/Colonel-Sandvich/trpc-vue-query It's still incredibly early days but it has Any issues or PRs are absolutely welcomed. |
First of all, @ozum I appreciate the effort you put in here. I'm sorry I did not merge this in, as I realized that it would be harder to maintain it in the future as I really just want to use the built-in composables in Nuxt. @Colonel-Sandvich that is so awesome, can I link your project in trpc-nuxt's docs if they want to use vue-query instead of built-in Nuxt composables? Thank you everyone! |
Absolutely feel free to link to my project. Thanks for making this project as it definitely was my main inspiration (and I've definitely copied some code too 😁). I'll credit you somewhere in the README if you want. I can link to trpc-nuxt in my README too if people want a more mature package with working SSR etc |
@wobsoriano, thanks for this library. I created this PR hoping it will help you to add vue-query support.
I'm unfamiliar with
tRPC
andvue-query
. I followed code from tRPC's react-query repository, but their integration contains react-specific parts and is very different than yours. I tried to stick with your coding style, but assume this PR is alpha quality. If you find it useful, please use it as a starting point.Changes:
trpc/client
, new feature is added totrpc-nuxt/client-vue-query
.useQuery()
anduseMutation()
methods.Simple Vue Query
to theUsage
docs.Notes:
trpc
library.Caveats:
router
object inplugins/2.client.ts
andserver/api/trpc/[trpc].ts
generates TS warning:@wobsoriano, I cannot fix this type. This didn't affect the types of the client-side, they worked as expected.