Vue Query live adapter
A published npm adapter bridging webedge-db live queries into TanStack Vue Query.
Vue Query live adapter
Challenge
Reactive backends often ship a React Query adapter, but Vue teams had to wire live queries into TanStack Vue Query by hand and invalidate the cache themselves.
What we did
A published TypeScript package that subscribes to the reactive backend over the WebSocket and writes each live result straight into the TanStack Vue Query cache.
Result
Vue 3 components use normal `useQuery` calls and the data stays live automatically — no refetch, no manual invalidation. Published on npm as `convex-vue-query`.
Dev-story article
Vue Query live adapter: how the project was built
TanStack Query is built on a pull model: you fetch, you cache, and you invalidate by hand when something changes. Our reactive backend works the opposite way, pushing new query results over a WebSocket the moment the underlying data moves. A React bridge for this pattern already existed, but Vue teams had nothing, so every screen ended up with hand-rolled subscription glue and stale-cache bugs.
Sections
05
Modules
05
Stack
TypeScript + Vue Query
Why the project exists
Reactive backends often ship a React Query adapter, but Vue teams had to wire live queries into TanStack Vue Query by hand and invalidate the cache themselves.
TanStack Query is built on a pull model: you fetch, you cache, and you invalidate by hand when something changes. Our reactive backend works the opposite way, pushing new query results over a WebSocket the moment the underlying data moves. A React bridge for this pattern already existed, but Vue teams had nothing, so every screen ended up with hand-rolled subscription glue and stale-cache bugs.
What was built
A published TypeScript package that subscribes to the reactive backend over the WebSocket and writes each live result straight into the TanStack Vue Query cache.
convex-vue-query is a small adapter that wires the reactive backend's live subscriptions into TanStack Vue Query as the transport layer. A ConvexQueryClient supplies a custom queryKeyHashFn and queryFn, connects to the shared QueryClient, and streams subscription updates directly into the cache. Components just call useQuery(convexQuery(...)) and the data stays live on its own.
Main modules and user path
convexQuery() plus a ConvexQueryClient that owns the queryKeyHashFn/queryFn pair and pushes WebSocket results into the TanStack cache instead of polling
Subscription lifecycle tied to observers: a live query is only open while a Vue Query observer is mounted, and inactive queries are unsubscribed so sockets don't leak
convexPaginatedQuery(), which injects paginationOpts and exposes live { results, status, canLoadMore, loadMore } for cursor-based lists
useConvexMutation() with native optimistic updates through the backend's local store, plus convexAction() for non-live action-as-query calls
SSR path via the HTTP client with consistent-query semantics by default, and an explicit disconnect() for HMR dispose and app teardown
Architecture and technology decisions
Built with TypeScript, Vue Query, webedge-db.
Written in TypeScript against Vue 3 and TanStack Vue Query, it mirrors the existing React adapter's contract and sets staleTime to Infinity since pushed data is never stale, keeping the whole thing a thin transport layer rather than a second cache.
Result and lessons
Vue 3 components use normal `useQuery` calls and the data stays live automatically — no refetch, no manual invalidation. Published on npm as `convex-vue-query`.
A published npm package that gives Vue apps realtime queries, pagination, and optimistic mutations with no manual invalidation, closing the gap between the reactive backend and the Vue ecosystem.
Related articles
Read next
Related project stories
These projects share nearby technical or product decisions, so they show how the same principle behaves in another context.
Dev-storyCMS
A dynamic headless CMS on webedge-db — content types, media, roles, and the public read API behind our sites and their articles.
Dev-storyVue + webedge-db security lab
Hands-on security labs for Vue 3 + webedge-db, solved by real exploits.
Dev-storyCalendar booking platform
Scheduling on Vue 3 — availability, bookings, confirmations and one-click Meet video links.
Have a similar idea?
Discuss your project