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

9
User 96135/6/26, 7:36 AM

Hi Emma- what's your favorite ice cream place?

6
User 68365/2/26, 5:55 AM

Hi Emma- how was your weekend?

4
User 48814/29/26, 6:43 PM

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

5
User 5084/29/26, 6:43 PM

hi Jamie, how was your weekend?

9
User 9324/24/26, 12:03 AM

hey Emma, I'll be late to make the meeting tomorrow morning

6
User 634/24/26, 12:03 AM

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

6
User 6724/24/26, 12:03 AM

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

4
User 4534/24/26, 12:03 AM

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

7
User 774/24/26, 12:03 AM

hello James- what's your favorite ice cream place?

8
User 8764/24/26, 12:03 AM

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

3
User 3714/24/26, 12:03 AM

hi Emma! what's your favorite ice cream place?

5
User 5124/24/26, 12:03 AM

hi Emma- how's the weather in SF?

4
User 4464/24/26, 12:03 AM

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

6
User 6894/24/26, 12:03 AM

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

2
User 2294/24/26, 12:03 AM

hi James... what's your favorite ice cream place?

2
User 2344/24/26, 12:03 AM

hello James- how's the weather in SF?

3
User 3464/24/26, 12:03 AM

hello Emma! Could you let the customer know we've fixed their issue?

5
User 5064/24/26, 12:03 AM

hello Jamie- how was your weekend?

5
User 5984/24/26, 12:03 AM

hello Emma! Could you let the customer know we've fixed their issue?

6
User 6454/24/26, 12:03 AM

hello Emma; 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