Documentation Index
Fetch the complete documentation index at: https://mintlify.com/get-convex/convex-react-query/llms.txt
Use this file to discover all available pages before exploring further.
ConvexQueryClient supports SSR by using ConvexHttpClient to fetch query results on the server. On the client, the WebSocket subscription takes over and keeps data live.
How it works
- On the server (
typeof window === "undefined"),convexQueryClient.queryFn()usesConvexHttpClientto make HTTP requests instead of opening a WebSocket subscription. - By default, SSR fetches use consistent mode: multiple queries are fetched from the same logical database snapshot. This prevents inconsistencies when your UI joins data across multiple queries.
- You can opt out with
dangerouslyUseInconsistentQueriesDuringSSR: truefor a faster but potentially inconsistent SSR render.
Basic SSR setup
ConstructConvexQueryClient with a serverFetch option to supply a custom fetch implementation for server-side HTTP requests.
Consistent vs. inconsistent SSR queries
Why consistent queries matter
When your React code joins data from multiple queries, both queries must reflect the same database state. In consistent mode, Convex guarantees this on the server.favChannelIds could reference channel IDs that don’t yet exist in channels because the two HTTP requests may have hit different database snapshots.
Using with TanStack Start
In TanStack Start, usecreateServerOnlyFn to ensure the serverFetch implementation is never bundled into the client.
During client-side navigation, the WebSocket subscription is used — SSR only
affects the initial server render.