- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.3k
          fix: merge serializationAdapters from createStart getOptions and router.options
          #5321
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
  
    fix: merge serializationAdapters from createStart getOptions and router.options
  
  #5321
              Conversation
| WalkthroughMerges 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
 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
 Suggested reviewers
 Poem
 Pre-merge checks and finishing touches❌ Failed checks (1 warning)
 ✅ Passed checks (2 passed)
 ✨ Finishing touches
 🧪 Generate unit tests
 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. Comment  | 
| View your CI Pipeline Execution ↗ for commit 79bd29c 
 ☁️ Nx Cloud last updated this comment at  | 
37cb198    to
    d72b1f0      
    Compare
  
    | More templates
 
 @tanstack/arktype-adapter
 @tanstack/directive-functions-plugin
 @tanstack/eslint-plugin-router
 @tanstack/history
 @tanstack/nitro-v2-vite-plugin
 @tanstack/react-router
 @tanstack/react-router-devtools
 @tanstack/react-router-ssr-query
 @tanstack/react-start
 @tanstack/react-start-client
 @tanstack/react-start-server
 @tanstack/router-cli
 @tanstack/router-core
 @tanstack/router-devtools
 @tanstack/router-devtools-core
 @tanstack/router-generator
 @tanstack/router-plugin
 @tanstack/router-ssr-query-core
 @tanstack/router-utils
 @tanstack/router-vite-plugin
 @tanstack/server-functions-plugin
 @tanstack/solid-router
 @tanstack/solid-router-devtools
 @tanstack/solid-start
 @tanstack/solid-start-client
 @tanstack/solid-start-server
 @tanstack/start-client-core
 @tanstack/start-plugin-core
 @tanstack/start-server-core
 @tanstack/start-static-server-functions
 @tanstack/start-storage-context
 @tanstack/valibot-adapter
 @tanstack/virtual-file-routes
 @tanstack/zod-adapter
 commit:  | 
serializationAdapters from createStart getOptions and router.optionsserializationAdapters from createStart getOptions and router.options
      There was a problem hiding this 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.serializationAdaptersis 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
📒 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 pushedServerFunctionSerializationAdapterbefore any existingrouter.options.serializationAdaptersensures proper precedence, and duplicates only occur if the adapter was manually registered elsewhere—no deduplication logic needed.
…nd `router.options`
f611be9    to
    c4ae950      
    Compare
  
    
Summary by CodeRabbit