perf: reduce repeated Zod validation work #8305
main fromperf/zod-validation-fast-path·opened 🎯 Changes#
Replaces #8301 with only the Zod validation work, based directly on main.
Compile the code-splitting grouping schema and check duplicates without flattening or copying arrays. Skip Zod parsing for Rspack modules without server-function metadata. Preserve grouping diagnostics and valid metadata parsing, including cloned output and unknown-key stripping.
Add behavior tests and Vitest benchmarks for grouping validation and metadata restoration.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
- I fully understand the code in this pull request, including any code generated with AI assistance.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
Performance
- Improved validation efficiency for code-splitting group configurations.
- Reduced unnecessary processing when reading server-function metadata during builds.
Bug Fixes
- Modules without server-function metadata are now handled safely during builds.
- Code-splitting configurations continue to reject duplicate or invalid entries with clearer validation results.
Documentation
- Updated Zod examples and usage guidance to reflect current import conventions.
Tests
- Added coverage and performance benchmarks for validation and metadata handling.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-plugin
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core
View your CI Pipeline Execution ↗ for commit 16d948700ff30215e009061ab6c4aec9edf4171e
Command Status Duration Result nx run-many --target=build --exclude=examples/*...✅ Succeeded 1m 46s View ↗
☁️ Nx Cloud last updated this comment at
2026-10-24 22:10:27UTC🚀 Changeset Version Preview#
6 package(s) bumped directly, 17 bumped as dependents.
🟩 Patch bumps#
Package Version Reason @tanstack/router-core1.171.39 → 1.171.40 Changeset @tanstack/router-plugin1.168.48 → 1.168.49 Changeset @tanstack/start-client-core1.170.39 → 1.170.40 Changeset @tanstack/start-plugin-core1.171.55 → 1.171.56 Changeset @tanstack/start-server-core1.169.45 → 1.169.46 Changeset @tanstack/start-static-server-functions1.167.44 → 1.167.45 Changeset @tanstack/react-router1.170.46 → 1.170.47 Dependent @tanstack/react-start1.169.4 → 1.169.5 Dependent @tanstack/react-start-client1.168.44 → 1.168.45 Dependent @tanstack/react-start-rsc0.1.65 → 0.1.66 Dependent @tanstack/react-start-server1.167.52 → 1.167.53 Dependent @tanstack/router-cli1.167.46 → 1.167.47 Dependent @tanstack/router-generator1.167.46 → 1.167.47 Dependent @tanstack/router-vite-plugin1.167.48 → 1.167.49 Dependent @tanstack/solid-router1.170.43 → 1.170.44 Dependent @tanstack/solid-start1.169.4 → 1.169.5 Dependent @tanstack/solid-start-client1.168.42 → 1.168.43 Dependent @tanstack/solid-start-server1.167.50 → 1.167.51 Dependent @tanstack/start-storage-context1.167.41 → 1.167.42 Dependent @tanstack/vue-router1.170.42 → 1.170.43 Dependent @tanstack/vue-start1.169.4 → 1.169.5 Dependent @tanstack/vue-start-client1.167.45 → 1.167.46 Dependent @tanstack/vue-start-server1.167.50 → 1.167.51 Dependent More templates
- 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-router-react-example-basic-authjs
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-rsbuild
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- 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-next-migration
- tanstack-start-example-rscs
- tanstack-start-streaming-data-from-server-functions
- 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-router-solid-example-authenticated-routes
- tanstack-router-solid-example-authenticated-routes-firebase
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-default-search-params
- 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-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-basic-virtual-file-based
- tanstack-router-solid-example-basic-virtual-inside-file-based
- tanstack-router-solid-example-deferred-data
- tanstack-router-solid-i18n-paraglide
- tanstack-router-solid-example-kitchen-sink
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-kitchen-sink-solid-query
- tanstack-router-solid-example-kitchen-sink-solid-query-file-based
- tanstack-router-solid-example-large-file-based
- tanstack-router-solid-example-location-masking
- tanstack-router-solid-example-navigation-blocking
- tanstack-router-solid-example-quickstart
- tanstack-router-solid-example-quickstart-esbuild-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-router-solid-example-quickstart-rspack-file-based
- tanstack-router-solid-example-quickstart-webpack-file-based
- @tanstack/router-solid-mono-simple
- router-solid-mono-simple-lazy
- router-solid-monorepo-solid-query
- tanstack-router-solid-example-scroll-restoration
- tanstack-solid-router-search-validator-adapters
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- tanstack-solid-start-example-basic-authjs
- tanstack-solid-start-example-basic-cloudflare
- tanstack-solid-start-example-basic-netlify
- tanstack-solid-start-example-basic-nitro
- tanstack-start-example-basic-solid-query
- tanstack-solid-start-example-basic-static
- tanstack-solid-start-bun-hosting
- tanstack-solid-start-example-convex-better-auth
- tanstack-solid-start-example-counter
- tanstack-solid-start-i18n-paraglide
- tanstack-solid-start-example-large
- tanstack-solid-start-streaming-data-from-server-functions
- tanstack-solid-start-example-supabase-basic
- tanstack-solid-start-tailwind-v4
- tanstack-router-solid-example-view-transitions
- tanstack-router-solid-example-with-framer-motion
- tanstack-router-solid-example-with-trpc
- tanstack-router-vue-example-basic-jsx
- tanstack-router-vue-example-basic-file-based-jsx
- tanstack-router-vue-example-basic-file-based-sfc
@tanstack/arktype-adapter
npm i https://pkg.pr.new/@tanstack/arktype-adapter@8305@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@8305@tanstack/eslint-plugin-start
npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8305@tanstack/history
npm i https://pkg.pr.new/@tanstack/history@8305@tanstack/react-router
npm i https://pkg.pr.new/@tanstack/react-router@8305@tanstack/react-router-devtools
npm i https://pkg.pr.new/@tanstack/react-router-devtools@8305@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@8305@tanstack/react-start
npm i https://pkg.pr.new/@tanstack/react-start@8305@tanstack/react-start-client
npm i https://pkg.pr.new/@tanstack/react-start-client@8305@tanstack/react-start-rsc
npm i https://pkg.pr.new/@tanstack/react-start-rsc@8305@tanstack/react-start-server
npm i https://pkg.pr.new/@tanstack/react-start-server@8305@tanstack/router-cli
npm i https://pkg.pr.new/@tanstack/router-cli@8305@tanstack/router-core
npm i https://pkg.pr.new/@tanstack/router-core@8305@tanstack/router-devtools
npm i https://pkg.pr.new/@tanstack/router-devtools@8305@tanstack/router-devtools-core
npm i https://pkg.pr.new/@tanstack/router-devtools-core@8305@tanstack/router-generator
npm i https://pkg.pr.new/@tanstack/router-generator@8305@tanstack/router-plugin
npm i https://pkg.pr.new/@tanstack/router-plugin@8305@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@8305@tanstack/router-utils
npm i https://pkg.pr.new/@tanstack/router-utils@8305@tanstack/router-vite-plugin
npm i https://pkg.pr.new/@tanstack/router-vite-plugin@8305@tanstack/solid-router
npm i https://pkg.pr.new/@tanstack/solid-router@8305@tanstack/solid-router-devtools
npm i https://pkg.pr.new/@tanstack/solid-router-devtools@8305@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8305@tanstack/solid-start
npm i https://pkg.pr.new/@tanstack/solid-start@8305@tanstack/solid-start-client
npm i https://pkg.pr.new/@tanstack/solid-start-client@8305@tanstack/solid-start-server
npm i https://pkg.pr.new/@tanstack/solid-start-server@8305@tanstack/start-client-core
npm i https://pkg.pr.new/@tanstack/start-client-core@8305@tanstack/start-fn-stubs
npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8305@tanstack/start-plugin-core
npm i https://pkg.pr.new/@tanstack/start-plugin-core@8305@tanstack/start-server-core
npm i https://pkg.pr.new/@tanstack/start-server-core@8305@tanstack/start-static-server-functions
npm i https://pkg.pr.new/@tanstack/start-static-server-functions@8305@tanstack/start-storage-context
npm i https://pkg.pr.new/@tanstack/start-storage-context@8305@tanstack/valibot-adapter
npm i https://pkg.pr.new/@tanstack/valibot-adapter@8305@tanstack/virtual-file-routes
npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8305@tanstack/vue-router
npm i https://pkg.pr.new/@tanstack/vue-router@8305@tanstack/vue-router-devtools
npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8305@tanstack/vue-router-ssr-query
npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8305@tanstack/vue-start
npm i https://pkg.pr.new/@tanstack/vue-start@8305@tanstack/vue-start-client
npm i https://pkg.pr.new/@tanstack/vue-start-client@8305@tanstack/vue-start-server
npm i https://pkg.pr.new/@tanstack/vue-start-server@8305@tanstack/zod-adapter
npm i https://pkg.pr.new/@tanstack/zod-adapter@8305commit:
16d9487Bundle Size Benchmarks#
This pull request does not affect bundle size in any measured scenario.
Merging this PR will not alter performance#
1 warning
:warning: 37 benchmarks are dominated by system calls
System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.
✅ 194untouched benchmarks⏩ 3skipped benchmarks1
Comparingperf/zod-validation-fast-path(16d9487) withmain(6b9fe6d)[^unexpected-base]Footnotes#
-
3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-core
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
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-static-server-functions
github-actions[bot](GitHub profile, opens in a new tab) added labelsdocumentation
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: react-router
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-generator
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-utils
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: zod-adapter
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-router
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: react-start
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-router
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We've reverted the
seroval/seroval-pluginsbump from^1.6.2to^1.6.7that was introduced on this branch (not present onmain) but never mentioned in the PR's stated intent of reducing Zod validation work. This dependency handles promise/stream serialization for SSR, and it was the only plausible source of thetanstack-solid-start-e2e-serialization-adapters:test:e2efailure, where the "stream" test hung for 30s waiting on a suspendedAwaitboundary to resolve. Restoring1.6.2removes the incidental regression risk while keeping the actual Zod code-splitting/metadata compilation changes intact.Tip
✅ We verified this fix by re-running
tanstack-solid-start-e2e-serialization-adapters:test:e2e.Warning
The suggested diff is too large to display here, but you can view it on Nx Cloud ↗
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally 5Syb-JdUf
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)🦋 Changeset detected#
Latest commit: 16d948700ff30215e009061ab6c4aec9edf4171e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 23 packages
Name Type @tanstack/router-core Patch @tanstack/router-plugin Patch @tanstack/start-client-core Patch @tanstack/start-plugin-core Patch @tanstack/start-server-core Patch @tanstack/start-static-server-functions Patch @tanstack/react-router Patch @tanstack/react-start-client Patch @tanstack/react-start-rsc Patch @tanstack/react-start-server Patch @tanstack/router-generator Patch @tanstack/solid-router Patch @tanstack/solid-start-client Patch @tanstack/solid-start-server Patch @tanstack/start-storage-context Patch @tanstack/vue-router Patch @tanstack/vue-start-client Patch @tanstack/vue-start-server Patch @tanstack/router-vite-plugin Patch @tanstack/react-start Patch @tanstack/solid-start Patch @tanstack/vue-start Patch @tanstack/router-cli Patch Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
- docs/router/api/router/retainSearchParamsFunction.md line 16@@ -13,4 +13,3 @@1313 ## Examples14141515 ```tsx16-import { z } from 'zod'
why were thoses imports changed?
please split this into separate PRs (e.g. one for zod upgrade, ...)
Sign in to join this conversation.
Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
c8a27c51-6f88-4377-9af6-37562963f1d8📥 Commits
Reviewing files that changed from the base of the PR and between 572e1ad7842f59af6099f2a569687d4a6b9ea511 and 0a079c5d5b2d6c52f7d067c843312b6121ffdfac.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml📒 Files selected for processing (1)
docs/router/how-to/share-search-params-across-routes.mdIncluded review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Walkthrough
The router plugin compiles split-group validation and detects duplicate nodes incrementally. The Start plugin tests guarded server-function metadata parsing. The change also standardizes Zod namespace imports, updates Seroval ranges, and adds benchmark scripts.
Changes: Plugin performance updates
packages/router-plugin/src/core/config.ts,packages/router-plugin/tests/split-groupings.*,packages/router-plugin/package.jsonpackages/start-plugin-core/src/rsbuild/start-compiler-host.ts,packages/start-plugin-core/tests/rsbuild/start-compiler-metadata.*,packages/start-plugin-core/package.json.changeset/sweet-lions-share.md,packages/*/package.json,benchmarks/ssr/package.json,docs/**,e2e/**,examples/**Estimated code review effort: 3 (Moderate) | ~25 minutes
Merge Risk:
Low · up to
0a079The change improves validation and metadata parsing performance. One documentation page may lack a visible H1 if no generated title is provided, making this a minor follow-up rather than a functional blocker.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
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