Replies: 1 comment 1 reply
-
|
I also stumbled upon the same issue: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I love TanStack Start and its promise of being "client-first" — building an SPA that feels like Vite, with the option to selectively prerender content-heavy pages at build time.
What I want to build
A fully client-first app (
defaultSsr: false) where most routes are classic SPA — but a few specific routes (e.g./blog,/docs) are statically prerendered at build time usingstaticFunctionMiddlewareandssr: true.Where it breaks today
defaultSsr: falseprevents route-levelssr: truefrom working — thestaticServerFnCacheis never generated at build time. This was reported in #7239 and confirmed as by design:The Selective SSR docs explain this inheritance model — a parent's
ssrcascades down to all children.The purpose of this discussion is to determine whether the inheritance constraint can be relaxed.
Workaround (hacky)
Doing a two-phase build: first with
defaultSsr: "data-only"to generate the cache, then copy assets and rebuild withdefaultSsr: false. It works, but it's fragile and shouldn't be necessary: https://github.com/fullheart/tanstack-start-static-server-function-build-workaroundInspiration from Astro
Astro takes a different approach: the global
outputmode sets a default, but every page can independently override it withexport const prerender = true | false— no inheritance. A page-level declaration always wins over the global default.That's the model I'd love for TanStack Start:
defaultSsras the fallback,ssrper route as the override.Questions
What's the best path forward? Should
defaultSsr: falseonly disable request-time SSR but still allow build-time SSG via route-levelssr: true? Or should we introduce a separate concept likeprerenderthat's independent of the SSR inheritance chain?Would love to hear your thoughts — especially from the team and anyone else building client-first apps with selective static pages.
Beta Was this translation helpful? Give feedback.
All reactions