Server-Side Rendering and Live Queries
TanStack Start routes render on the server for the first pageload of a browsing session. Neither the React Query nor standard Convex useQuery()
hooks kick off requests for this data during this initial SSR pass, but the React Query hook useSuspenseQuery()
does. The React Query client is then serialized with whatever data was loaded to make it available in the browser at hydration time. This reduces rendering on the server and updating on the client from two steps to one step: isomorphic data fetching with a single hook.
Try reloading this page to see the difference between useSuspenseQuery()
and useQuery()
.
hi James! Could you let the customer know we've fixed their issue?
hello Jamie... how was your weekend?
hi Jamie; how's the weather in SF?
hello Emma- what's your favorite ice cream place?
hey Jamie- I'll be late to make the meeting tomorrow morning
hey Jamie! how was your weekend?
hi Jamie; Could you let the customer know we've fixed their issue?
hi Emma... Could you let the customer know we've fixed their issue?
Hi Jamie! what's your favorite ice cream place?
hello James; Could you let the customer know we've fixed their issue?
Hi Emma, how's the weather in SF?
hello James... what's your favorite ice cream place?
hello Nipunn; what's your favorite ice cream place?
hello Jamie- how was your weekend?
Hi James; what's your favorite ice cream place?
hi James... how was your weekend?
Hi James- Could you let the customer know we've fixed their issue?
Hi Emma... Could you let the customer know we've fixed their issue?
hello James- how was your weekend?
hey Emma- how's the weather in SF?
1const { data } = useSuspenseQuery(convexQuery(2 api.messages.listMessages,3 { channel: "chatty" }4))
1const { data, isPending } = useQuery(convexQuery(2 api.messages.listMessages,3 { channel: "chatty" }4))
On the browser these queries resume their subscriptions which you can see by .
Another way to opt into server-side data loading is to load the query in a loader.