Skip to content

perf: unify route bindings in constructors - #8074

Open
Sheraff wants to merge 2 commits into
mainfrom
perf-all-adapters-unify-route-bindings
Open

perf: unify route bindings in constructors#8074
Sheraff wants to merge 2 commits into
mainfrom
perf-all-adapters-unify-route-bindings

Conversation

@Sheraff

@Sheraff Sheraff commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Improvements

    • Reduced router bundle size across React, Solid, and Vue integrations through unified route API bindings.
    • Preserved route-specific hooks, navigation, matching, data access, and Link behavior.
  • Bug Fixes

    • Ensured regular and root routes consistently expose all expected framework APIs and link functionality.
  • Tests

    • Added coverage verifying route and root route API availability across all supported frameworks.

@nx-cloud

nx-cloud Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit e027650

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

☁️ Nx Cloud last updated this comment at 2026-08-14 22:11:04 UTC

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The React, Solid, and Vue routers now install route APIs through shared initializers. Route-specific IDs and paths remain bound. Tests verify that route and root route instances own every API member. A patch changeset covers all three packages.

Changes

Unified route API bindings

Layer / File(s) Summary
React route API initialization
packages/react-router/src/route.tsx, packages/react-router/tests/route.test.tsx, .changeset/easy-streets-stare.md
Route and RootRoute use initReactRouteApi. Tests verify ownership of hooks and Link. The changeset declares patch releases for the three router packages.
Solid route API initialization
packages/solid-router/src/route.tsx, packages/solid-router/tests/route.test.tsx
Route and RootRoute use initSolidRouteApi. The initializer assigns route-scoped hooks, navigation, and Link. Tests verify own-property exposure.
Vue route API initialization
packages/vue-router/src/route.ts, packages/vue-router/tests/route.test.tsx
Route and RootRoute use initVueRouteApi. The initializer preserves route IDs, full paths, selector forwarding, and non-strict loader calls. Tests verify hook and Link ownership.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to 258ce

The constructor-based route-binding refactor is localized across the three adapters, but the initializer target typing may reject adapter-specific members under strict TypeScript, potentially causing build or type-check failures. This is currently unverified and is not a merge blocker, but it should receive explicit owner follow-up.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the performance change: shared route bindings initialized in constructors across the React, Solid, and Vue adapters.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf-all-adapters-unify-route-bindings

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.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 555013f53112
  • Measured at: 2026-08-14T22:00:54.642Z
  • Baseline source: history:bdaf73a4063e
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 83.84 KiB +1 B (+0.00%) 83.70 KiB 261.93 KiB 73.01 KiB █▁▁▁▁▁▁▆▆▄▁▁
react-router.full 87.33 KiB +3 B (+0.00%) 87.20 KiB 273.63 KiB 76.06 KiB █▃▂▂▂▂▃▆▆▃▁▁
solid-router.minimal 33.09 KiB -24 B (-0.07%) 32.97 KiB 95.68 KiB 29.87 KiB █▅▅▅▅▅▅▅▅▄▂▁
solid-router.full 37.92 KiB -24 B (-0.06%) 37.79 KiB 110.32 KiB 34.11 KiB █▄▄▄▅▅▅▅▅▄▂▁
vue-router.minimal 49.49 KiB -9 B (-0.02%) 49.37 KiB 137.88 KiB 44.65 KiB ▄▁▁▁█▇███▅▃▃
vue-router.full 55.10 KiB -11 B (-0.02%) 54.98 KiB 156.09 KiB 49.62 KiB ▄▁▁▁█████▆▄▄
react-start.minimal 96.63 KiB -5 B (-0.01%) 96.50 KiB 304.15 KiB 83.78 KiB █▃▃▃▃▃▃▆▆▃▁▁
react-start.deferred-hydration 97.36 KiB -7 B (-0.01%) 96.52 KiB 305.51 KiB 84.45 KiB █▂▂▂▂▂▂▆▆▄▁▁
react-start.full 99.80 KiB -1 B (-0.00%) 99.66 KiB 313.87 KiB 86.56 KiB █▃▃▃▃▃▃▆▆▃▁▁
react-start.rsbuild.minimal 99.95 KiB -30 B (-0.03%) 99.78 KiB 314.48 KiB 86.31 KiB █▂▂▂▂▂▂▆▆▆▃▁
react-start.rsbuild.minimal-iife 100.36 KiB -27 B (-0.03%) 100.19 KiB 315.42 KiB 86.54 KiB █▂▂▂▂▂▂▆▆▆▃▁
react-start.rsbuild.full 103.30 KiB +5 B (+0.00%) 103.13 KiB 324.62 KiB 89.03 KiB █▁▁▁▁▁▁▅▅▅▂▂
solid-start.minimal 45.86 KiB -6 B (-0.01%) 45.74 KiB 136.74 KiB 40.87 KiB █▅▅▅▅▅▅▅▅▃▁▁
solid-start.deferred-hydration 48.95 KiB -5 B (-0.01%) 45.81 KiB 144.20 KiB 43.67 KiB █▅▅▅▅▅▅▅▅▃▁▁
solid-start.full 50.94 KiB -24 B (-0.05%) 50.82 KiB 152.13 KiB 45.14 KiB █▅▅▅▅▅▅▅▅▄▂▁
vue-start.minimal 65.53 KiB -29 B (-0.04%) 65.41 KiB 188.71 KiB 58.29 KiB ▄▁▁▁█████▆▅▄
vue-start.full 69.35 KiB -26 B (-0.04%) 69.23 KiB 201.01 KiB 61.64 KiB ▄▁▁▁█████▆▅▃

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

4 package(s) bumped directly, 19 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.28 → 1.170.29 Changeset
@tanstack/router-core 1.171.23 → 1.171.24 Changeset
@tanstack/solid-router 1.170.26 → 1.170.27 Changeset
@tanstack/vue-router 1.170.25 → 1.170.26 Changeset
@tanstack/react-start 1.168.45 → 1.168.46 Dependent
@tanstack/react-start-client 1.168.26 → 1.168.27 Dependent
@tanstack/react-start-rsc 0.1.44 → 0.1.45 Dependent
@tanstack/react-start-server 1.167.33 → 1.167.34 Dependent
@tanstack/router-cli 1.167.29 → 1.167.30 Dependent
@tanstack/router-generator 1.167.29 → 1.167.30 Dependent
@tanstack/router-plugin 1.168.31 → 1.168.32 Dependent
@tanstack/router-vite-plugin 1.167.31 → 1.167.32 Dependent
@tanstack/solid-start 1.168.43 → 1.168.44 Dependent
@tanstack/solid-start-client 1.168.25 → 1.168.26 Dependent
@tanstack/solid-start-server 1.167.32 → 1.167.33 Dependent
@tanstack/start-client-core 1.170.23 → 1.170.24 Dependent
@tanstack/start-plugin-core 1.171.35 → 1.171.36 Dependent
@tanstack/start-server-core 1.169.27 → 1.169.28 Dependent
@tanstack/start-static-server-functions 1.167.28 → 1.167.29 Dependent
@tanstack/start-storage-context 1.167.25 → 1.167.26 Dependent
@tanstack/vue-start 1.168.42 → 1.168.43 Dependent
@tanstack/vue-start-client 1.167.28 → 1.167.29 Dependent
@tanstack/vue-start-server 1.167.32 → 1.167.33 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@8074

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8074

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@8074

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@8074

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@8074

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@8074

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@8074

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8074

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@8074

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@8074

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@8074

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@8074

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8074

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@8074

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@8074

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@8074

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@8074

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8074

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@8074

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8074

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8074

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@8074

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@8074

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@8074

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@8074

commit: e027650

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔇 Additional comments (5)
packages/react-router/src/route.tsx (1)

508-549: 📐 Maintainability & Code Quality

⚠️ Unverified finding
Sandbox verification was unavailable.

Verify the initializer target type.

Each initializer accepts AnyRoute but writes adapter-specific use*, useNavigate, and Link members. If AnyRoute resolves to the core route type, strict TypeScript rejects these property assignments. Use an adapter-specific target interface or intersection type that declares the assigned members.

  • packages/react-router/src/route.tsx#L508-L549: type the initializer target with the React route API members.
  • packages/solid-router/src/route.tsx#L466-L499: type the initializer target with the Solid route API members.
  • packages/vue-router/src/route.ts#L472-L509: type the initializer target with the Vue route API members.

As per coding guidelines, **/*.{ts,tsx} must use TypeScript strict mode with extensive type safety.

packages/react-router/tests/route.test.tsx (1)

79-86: LGTM!

.changeset/easy-streets-stare.md (1)

1-7: LGTM!

packages/solid-router/tests/route.test.tsx (1)

78-85: LGTM!

packages/vue-router/tests/route.test.tsx (1)

78-85: LGTM!


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c5d945d0-33f1-4ce1-ae9d-6490d8c92e50

📥 Commits

Reviewing files that changed from the base of the PR and between 53b63cf and 258ce56.

📒 Files selected for processing (7)
  • .changeset/easy-streets-stare.md
  • packages/react-router/src/route.tsx
  • packages/react-router/tests/route.test.tsx
  • packages/solid-router/src/route.tsx
  • packages/solid-router/tests/route.test.tsx
  • packages/vue-router/src/route.ts
  • packages/vue-router/tests/route.test.tsx

@codspeed-hq

codspeed-hq Bot commented Aug 14, 2026

Copy link
Copy Markdown

Merging this PR will regress 5 benchmarks

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 7 improved benchmarks
❌ 7 (👁 2) regressed benchmarks
✅ 166 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem client unique-location-churn (solid) 325.9 KB 348.1 KB -6.38%
Memory mem server error-paths redirect (react) 303.6 KB 323.1 KB -6.02%
Memory mem server peak-large-page (vue) 1,010.6 KB 1,058.7 KB -4.54%
Memory mem server request-churn (solid) 728.8 KB 762.9 KB -4.47%
Memory mem server error-paths unmatched (react) 415.8 KB 433.7 KB -4.13%
Memory mem client navigation-churn (vue) 1.7 MB 1.6 MB +6.63%
Simulation client-search-params navigation loop (react) 177 ms 168.4 ms +5.11%
Memory mem server server-fn-churn (solid) 360.3 KB 345.1 KB +4.4%
Memory mem server aborted-requests (solid) 1.3 MB 1.2 MB +4.31%
Memory mem server server-fn-churn (react) 395.7 KB 381 KB +3.87%
Memory mem server error-paths not-found (solid) 584.7 KB 563.9 KB +3.69%
👁 Memory mem server error-paths not-found (vue) 2,190.4 KB 503.6 KB ×4.3
👁 Memory mem server error-paths not-found (react) 373.4 KB 411.7 KB -9.3%
👁 Memory mem client unique-location-churn (vue) 487.9 KB 593.6 KB -17.8%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing perf-all-adapters-unify-route-bindings (e027650) with main (bdaf73a)

Open in CodSpeed

nx-cloud[bot]

This comment was marked as outdated.

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 has identified a possible root cause for your failed CI:

We classified this failure as an environment issue rather than a code change because the error — a version mismatch between @rspack/core@2.0.8 and @rspack/binding@2.0.0 — is unrelated to the route-binding refactor in this PR. The failing project (tanstack-start-example-basic-rsbuild) was not touched by our changes, and no lockfile or package configuration was modified. Reinstalling dependencies to align the rspack package versions should resolve the build failure.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

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.

1 participant