Skip to content

Note

Choosing a rendering mode for each route

Fariz1 min read1 views

TanStack Start renders on the server by default. That default is correct for a public, indexable page, and wrong for a private dashboard, so the useful question is not which mode the framework prefers but which mode each route needs.

Three answers cover most routes. Full server rendering for anything that search engines should read. Data-only rendering when the server should prepare data but the browser can do the drawing, which avoids paying server render time for a chart that only exists on the client. Server rendering off when a screen is private, interactive, and has nothing to index.

The mode is set per route with the ssr option, and children inherit the parent's value while only being able to make it stricter. A private subtree therefore declares ssr: false once, at its layout, and every screen inside it is client rendered without repeating the decision.

What is easy to miss is the cost. Turning server rendering off means the visitor sees a pending state instead of a rendered page, and it means the route's loaders only run in the browser. Both are reasonable for a dashboard and unacceptable for a landing page.

Reader comments

Loading comments...

Leave a comment

Comments are open to readers without an account. Nothing here is moderated, which is one of the reasons this app is a reference rather than a product.

More notes