Summary
TanStack Router SSR support merged in PR #2516 and now correctly uses the public async router.load() API.
However, the current server-side helper still depends on a private/internal TanStack Router behavior:
router.ssr = true in packages/react-on-rails-pro/src/tanstack-router/serverRender.ts
Why This Is Still Fragile
This flag is not part of the standalone TanStack Router public contract. It is currently used to avoid client-only Suspense / initial-load behavior that can cause hydration mismatches, but it still creates an upgrade risk:
- TanStack could change or remove the behavior in a minor or patch release.
- React on Rails would only discover the breakage at runtime after upgrade.
- The current helper includes a runtime assertion, but that only makes the failure clearer; it does not remove the compatibility risk.
Current State
The previous __store.setState() workaround is gone, which is good.
The remaining follow-up is specifically to remove or reduce the dependency on the router.ssr flag.
Proposed Follow-up
- Track / advocate for a public TanStack Router API for this behavior (for example a
skipInitialLoad-style option or equivalent hydration-safe SSR mode).
- Replace
router.ssr = true once TanStack exposes a supported public alternative.
- Until then, keep compatibility guidance explicit in docs and consider tightening the supported-version guard if needed.
Related
Summary
TanStack Router SSR support merged in PR #2516 and now correctly uses the public async
router.load()API.However, the current server-side helper still depends on a private/internal TanStack Router behavior:
router.ssr = trueinpackages/react-on-rails-pro/src/tanstack-router/serverRender.tsWhy This Is Still Fragile
This flag is not part of the standalone TanStack Router public contract. It is currently used to avoid client-only Suspense / initial-load behavior that can cause hydration mismatches, but it still creates an upgrade risk:
Current State
The previous
__store.setState()workaround is gone, which is good.The remaining follow-up is specifically to remove or reduce the dependency on the
router.ssrflag.Proposed Follow-up
skipInitialLoad-style option or equivalent hydration-safe SSR mode).router.ssr = trueonce TanStack exposes a supported public alternative.Related