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().

2
User 23511/11/25, 8:30 AM

hi Jamie! I'll be late to make the meeting tomorrow morning

4
User 4911/11/25, 8:30 AM

hello Nipunn- how was your weekend?

9
User 9911/11/25, 8:30 AM

Hi James, I'll be late to make the meeting tomorrow morning

4
User 41211/11/25, 8:30 AM

hi Nipunn... how was your weekend?

4
User 47211/11/25, 8:30 AM

hi Nipunn... I'll be late to make the meeting tomorrow morning

5
User 55211/11/25, 8:30 AM

hey Nipunn- Could you let the customer know we've fixed their issue?

7
User 71011/11/25, 8:30 AM

hey Emma; how's the weather in SF?

8
User 82611/11/25, 8:30 AM

hey Nipunn- how's the weather in SF?

4
User 45111/11/25, 8:30 AM

hi Emma- I'll be late to make the meeting tomorrow morning

9
User 97911/11/25, 8:30 AM

hi Nipunn! Could you let the customer know we've fixed their issue?

8
User 85311/11/25, 8:30 AM

hi Emma; Could you let the customer know we've fixed their issue?

2
User 26311/11/25, 8:30 AM

hi Emma... how's the weather in SF?

6
User 6711/11/25, 8:30 AM

hey Nipunn! what's your favorite ice cream place?

1
User 15111/11/25, 8:30 AM

hello Emma! how was your weekend?

9
User 952511/11/25, 8:30 AM

hey James, how's the weather in SF?

1
User 100811/10/25, 1:02 PM

Hi Nipunn- how was your weekend?

1
User 100811/10/25, 1:01 PM

hey Emma; what's your favorite ice cream place?

1
User 100811/10/25, 1:01 PM

Hi James, what's your favorite ice cream place?

1
User 100811/10/25, 1:01 PM

hey Nipunn, Could you let the customer know we've fixed their issue?

8
User 876311/10/25, 12:37 PM

hey James, how was your weekend?

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.

Learn More

TanStack Start SSR Guide