Introducing the new Vue Query client


Eelco Wiersma
Introducing WunderGraph Hub: Rethinking How Teams Build APIs
WunderGraph Hub is our new collaborative platform for designing, evolving, and shipping APIs together. Itβs a design-first workspace that brings schema design, mocks, and workflows into one place.
After React and Solid, we now have official Vue support! π.
This new client is built on top of Vue Query , and brings all the good stuff from WunderGraph to the Vue ecosystem. Query, mutate and subscribe to your WunderGraph API fully typesafe in Vue.
The integration has been built by one of our community members, Hebilicious . Thanks Emmanuel, you rock!
Let's have a quick look at how to set it up in a Nuxt project and how to use it. (this assumes you already have Nuxt and WunderGraph installed).
Install the Vue Query client:
Before you can use the hooks, you need to modify your code generation to include the base typescript client.
Now we need to configure the Vue Query client. We'll create a plugin for this.
Turn queries into live queries, live queries are refetched on a interval on the WunderGraph server.
Build realtime apps with subscriptions.
Let's say we have a query that fetches the current user's profile in one component and we have a form that updates the profile. We can add an onSuccess handler to the mutation that calls queryClient.invalidateQueries on the GetProfile query and trigger a refetch and update the internal React Query cache.
Check out the reference and example app below to learn more about the new Vue Query integration.
We're very excited to see the community building integrations for WunderGraph. If you have ideas for other integrations, let us know in the comments below or join us on our Discord server .
