fix: merge `serializationAdapters` from `createStart` `getOptions` and `router.options` #5321
main fromrefs/pull/5321/head·merged by schiller-manuel(GitHub profile, opens in a new tab) 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.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-server-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-client-core
View your CI Pipeline Execution ↗ for commit 79bd29cdf9f409665509eba865523de124d1ae4a
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:35UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-static
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@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@5321commit:
79bd29cphryneas(GitHub profile, opens in a new tab) changed the title
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
📥 Commits
Reviewing files that changed from the base of the PR and between af388a89f783b158f5725056192a278dde3155f8 and d72b1f075e68edabe9be7b54ff999eacd10b517c.
📒 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.tspackages/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.tspackages/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.
Sign in to join this conversation.
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#
packages/start-client-core/src/client/hydrateStart.ts,packages/start-server-core/src/createStartHandler.tsSequence Diagram(s)#
Estimated code review effort#
🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs#
Suggested reviewers#
Poem#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ 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.
❤️ Share