Skip to content

Conversation

phryneas
Copy link
Contributor

@phryneas phryneas commented Oct 1, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Serialization adapters are now merged from both app configuration and router-defined options on client and server. This preserves existing adapters and ensures new adapters are applied without overriding user settings. Improves compatibility when using multiple adapters, preventing missing or incorrect serialization during hydration and routing updates.

Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Merges serializationAdapters from multiple sources. Client hydration now combines existing router.options.serializationAdapters with the current set to ensure inclusion of ServerFunctionSerializationAdapter. Server handler updates pass a unified adapters array to router.update by merging startOptions.serializationAdapters with any on router.options. No public API or error-handling changes.

Changes

Cohort / File(s) Summary
Serialization adapter merge logic
packages/start-client-core/src/client/hydrateStart.ts, packages/start-server-core/src/createStartHandler.ts
Client: build adapters array by prepending current serializationAdapters and appending any existing router.options.serializationAdapters. Server: during router.update, merge startOptions.serializationAdapters with router.options.serializationAdapters into a single ordered list. No other logic altered.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as App Start
  participant Router as Router
  participant Cfg as startOptions/router.options

  Note over App,Router: Initialization / Hydration
  App->>Cfg: Read serializationAdapters (startOptions + router.options)
  App->>App: Merge adapters into ordered array
  App->>Router: router.update({ serializationAdapters: merged })
  Router-->>App: Update complete
Loading
sequenceDiagram
  autonumber
  participant Client as Client Hydration
  participant Router as Router

  Note over Client,Router: Client-side hydration
  Client->>Router: Determine current serializationAdapters
  Client->>Client: Prepend current, append router.options.adapters
  Client->>Router: Set router.options.serializationAdapters = merged
  Router-->>Client: Ready with combined adapters
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • chorobin

Poem

I hop through routes with tidy care,
Merging adapters here and there.
Two streams join—no bytes are lost,
A gentle blend at minimal cost.
Thump-thump! the router smiles wide,
With every hop, our states abide. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the main change by stating that serializationAdapters are now merged from the createStart getOptions and router.options, directly reflecting the implemented behavior in both client and server core packages. It uses precise terminology relevant to the code changes and avoids unnecessary detail, making the intent immediately understandable to reviewers.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

nx-cloud bot commented Oct 1, 2025

View your CI Pipeline Execution ↗ for commit 79bd29c

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 4m 37s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 20s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-05 21:45:35 UTC

@phryneas phryneas force-pushed the pr/merge-serializationAdapters branch from 37cb198 to d72b1f0 Compare October 1, 2025 11:12
Copy link

pkg-pr-new bot commented Oct 1, 2025

More templates

@tanstack/arktype-adapter

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

@tanstack/directive-functions-plugin

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/server-functions-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/zod-adapter

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

commit: 79bd29c

@phryneas phryneas changed the title feat: merge serializationAdapters from createStart getOptions and router.options fix: merge serializationAdapters from createStart getOptions and router.options Oct 1, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/start-server-core/src/createStartHandler.ts (1)

171-174: Remove redundant fallback on line 172.

Since lines 183-184 ensure startOptions.serializationAdapters is always an array, the || [] fallback on line 172 is unnecessary.

Apply this diff:

           serializationAdapters: [
-            ...(startOptions.serializationAdapters || []),
+            ...startOptions.serializationAdapters,
             ...(router.options?.serializationAdapters || []),
           ],
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between af388a8 and d72b1f0.

📒 Files selected for processing (2)
  • packages/start-client-core/src/client/hydrateStart.ts (1 hunks)
  • packages/start-server-core/src/createStartHandler.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript in strict mode with extensive type safety across the codebase

Files:

  • packages/start-server-core/src/createStartHandler.ts
  • packages/start-client-core/src/client/hydrateStart.ts
packages/{*-start,start-*}/**

📄 CodeRabbit inference engine (AGENTS.md)

Name and place Start framework packages under packages/-start/ or packages/start-/

Files:

  • packages/start-server-core/src/createStartHandler.ts
  • packages/start-client-core/src/client/hydrateStart.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Test
🔇 Additional comments (2)
packages/start-server-core/src/createStartHandler.ts (1)

171-174: Merge order matches client-side implementation.

The merge order (start adapters followed by router adapters) is consistent with the client-side implementation in hydrateStart.ts (lines 28-31). This ensures uniform adapter precedence across both environments.

packages/start-client-core/src/client/hydrateStart.ts (1)

28-31: Adapter merge and order are correct
Merging the newly pushed ServerFunctionSerializationAdapter before any existing router.options.serializationAdapters ensures proper precedence, and duplicates only occur if the adapter was manually registered elsewhere—no deduplication logic needed.

@schiller-manuel schiller-manuel force-pushed the pr/merge-serializationAdapters branch from f611be9 to c4ae950 Compare October 5, 2025 21:30
@schiller-manuel schiller-manuel merged commit 1d71851 into TanStack:main Oct 5, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants