Skip to content
Source
Sign inSign up
TanStack/router

fix: opt into SSR type level serializability check #5233

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5233/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

default false was not working for plain router

fixes #5222

Summary by CodeRabbit

  • Refactor

    • Standardized SSR registration across React Start and Solid Start by introducing a unified SSR flag in public typings.
    • Added a shared SSR type in the router core and updated internal serializers to use it.
    • No runtime behavior changes; improvements are type-level only.
  • Chores

    • Regenerated route trees in examples and end-to-end setups to include the SSR flag, ensuring consistent SSR-aware type checking across projects.
    1. Caution

      Review failed

      The pull request is closed.

      Walkthrough

      Adds an ssr: true property to Register interface augmentations across React Start and Solid Start routeTree.gen.ts files. Introduces a new RegisteredSsr type in router-core and updates serializer transformer types to use it. Updates start-plugin-core to declare ssr: true in its Register module augmentation.

      Changes

      Cohort / File(s)Summary
      React Start e2e typings
      e2e/react-start/*/src/routeTree.gen.ts
      Augment module @tanstack/react-start: add ssr: true to interface Register alongside existing router typing.
      Solid Start e2e typings
      e2e/solid-start/*/.../routeTree.gen.ts
      Augment module @tanstack/solid-start: add ssr: true to interface Register alongside existing router typing.
      React Start examples typings
      examples/react/*/src/routeTree.gen.ts
      Augment module @tanstack/react-start: add ssr: true to interface Register.
      Solid Start examples typings
      examples/solid/*/routeTree.gen.ts
      Augment module @tanstack/solid-start: add ssr: true to interface Register.
      Router-core types
      packages/router-core/src/router.ts
      Add exported utility type RegisteredSsr<TRegister = Register> inferring ssr presence; defaults to false when absent.
      Router-core serializer transformer
      packages/router-core/src/ssr/serializer/transformer.ts
      Replace inline SSR inference with RegisteredSsr<TRegister> in conditional branches of ValidateSerializableLifecycleResult.
      Start plugin core declaration
      packages/start-plugin-core/src/start-router-plugin/plugin.ts
      Module augmentation for @tanstack/${corePluginOpts.framework}-start: add ssr: true to interface Register.

      Sequence Diagram(s)

      Estimated code review effort

      🎯 3 (Moderate) | ⏱️ ~20 minutes

      • TanStack/router#5199 — Touches the same serializer types in packages/router-core/src/ssr/serializer/transformer.ts, potentially interacting with the new RegisteredSsr-based branching.

      Suggested labels

      package: router-core

      Poem

      I thump my paw—types align! Little ssr: true, a tidy sign. Routes all whisper, “Server’s near,” While serializers lend an ear. In burrows of generics, I hop with glee— Compile-time carrots for you and me. 🥕✨

      ✨ Finishing touches
      • 📝 Generate Docstrings
        🧪 Generate unit tests
      • Create PR with unit tests
      • Post copyable unit tests in a comment
      • Commit unit tests in branch `ssr-optin`

      📜 Recent review details

      Configuration used: CodeRabbit UI

      Review profile: CHILL

      Plan: Pro

      📥 Commits

      Reviewing files that changed from the base of the PR and between 86aa74e345839b055e72ccabe5d82a3c16c6170f and 91ccee2c5db1df3a606fadd707608893d834f229.

      📒 Files selected for processing (42)
      • e2e/react-start/basic-auth/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/basic-react-query/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/basic-tsr-config/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/basic/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/custom-basepath/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/query-integration/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/scroll-restoration/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/selective-ssr/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/serialization-adapters/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/server-functions/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/server-routes/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/spa-mode/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/virtual-routes/src/routeTree.gen.ts (1 hunks)
      • e2e/react-start/website/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/basic/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/custom-basepath/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/scroll-restoration/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/selective-ssr/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/server-functions/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/server-routes/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/spa-mode/src/routeTree.gen.ts (1 hunks)
      • e2e/solid-start/website/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-bare/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-basic-auth/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-basic-react-query/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-basic-static/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-basic/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-convex-trellaux/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-counter/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-large/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-material-ui/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-supabase-basic/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-tailwind-v4/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-trellaux/src/routeTree.gen.ts (1 hunks)
      • examples/react/start-workos/src/routeTree.gen.ts (1 hunks)
      • examples/solid/start-bare/src/routeTree.gen.ts (1 hunks)
      • examples/solid/start-basic-static/src/routeTree.gen.ts (1 hunks)
      • examples/solid/start-basic/src/routeTree.gen.ts (1 hunks)
      • packages/router-core/src/router.ts (1 hunks)
      • packages/router-core/src/ssr/serializer/transformer.ts (2 hunks)
      • packages/start-plugin-core/src/start-router-plugin/plugin.ts (1 hunks)

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-core

    3. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core

    4. View your CI Pipeline Execution ↗ for commit 91ccee2c5db1df3a606fadd707608893d834f229

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded4m 8sView ↗
      nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 21sView ↗

      ☁️ Nx Cloud last updated this comment at 2025-09-25 15:27:51 UTC

    5. More templates

      @tanstack/arktype-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5233

      @tanstack/directive-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5233

      @tanstack/eslint-plugin-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5233

      @tanstack/history

      npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5233

      @tanstack/nitro-v2-vite-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5233

      @tanstack/react-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5233

      @tanstack/react-router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5233

      @tanstack/react-router-ssr-query

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5233

      @tanstack/react-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5233

      @tanstack/react-start-client

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5233

      @tanstack/react-start-server

      npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5233

      @tanstack/router-cli

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5233

      @tanstack/router-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5233

      @tanstack/router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5233

      @tanstack/router-devtools-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5233

      @tanstack/router-generator

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5233

      @tanstack/router-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5233

      @tanstack/router-ssr-query-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5233

      @tanstack/router-utils

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5233

      @tanstack/router-vite-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5233

      @tanstack/server-functions-plugin

      npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5233

      @tanstack/solid-router

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5233

      @tanstack/solid-router-devtools

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5233

      @tanstack/solid-start

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5233

      @tanstack/solid-start-client

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5233

      @tanstack/solid-start-server

      npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5233

      @tanstack/start-client-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5233

      @tanstack/start-plugin-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5233

      @tanstack/start-server-core

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5233

      @tanstack/start-static-server-functions

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5233

      @tanstack/start-storage-context

      npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5233

      @tanstack/valibot-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5233

      @tanstack/virtual-file-routes

      npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5233

      @tanstack/zod-adapter

      npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5233

      commit: 91ccee2

Sign in to join this conversation.