Skip to content

perf(router): remove prebuilt preload locations - #8132

Merged
schiller-manuel merged 1 commit into
mainfrom
remove-builtlocation
Aug 20, 2026
Merged

perf(router): remove prebuilt preload locations#8132
schiller-manuel merged 1 commit into
mainfrom
remove-builtlocation

Conversation

@schiller-manuel

@schiller-manuel schiller-manuel commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Client-side route preloading now builds link destinations on demand.
    • Framework links use simplified preloading behavior without requiring a prebuilt location.
  • Bug Fixes

    • Improved handling of redirects, inactive preloads, document reloads, and development refresh states.
    • Ensured preload resources are cleaned up after each attempt.
  • Tests

    • Updated Solid and Vue link tests to verify search updates and streamlined preload calls.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eac75c5a-9555-4013-9ee7-5347ea1de62c

📥 Commits

Reviewing files that changed from the base of the PR and between e9f63a6 and 20ccf36.

📒 Files selected for processing (7)
  • .changeset/calm-links-preload.md
  • packages/router-core/src/load-client.ts
  • packages/router-core/src/router.ts
  • packages/solid-router/src/link.tsx
  • packages/solid-router/tests/link.test.tsx
  • packages/vue-router/src/link.tsx
  • packages/vue-router/tests/link.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Client preloading now builds locations on demand in router-core. Redirect handling uses an iterative flow with cleanup and stop conditions. Solid and Vue links pass only navigation options, and tests verify the updated calls.

Changes

Client preload flow

Layer / File(s) Summary
Typed preload contract
packages/router-core/src/load-client.ts, packages/router-core/src/router.ts
The preload API now uses typed navigation and dehydrated-state generics. RouterCore.preloadRoute passes only the router and navigation options.
Location construction and redirect execution
packages/router-core/src/load-client.ts
preloadClientRoute builds locations internally, tracks controllers and resources, and iteratively follows eligible redirects.
Framework link integration and validation
packages/solid-router/src/link.tsx, packages/solid-router/tests/link.test.tsx, packages/vue-router/src/link.tsx, packages/vue-router/tests/link.test.tsx, .changeset/calm-links-preload.md
Solid and Vue links pass typed options only. Intent-preload tests verify search updates and single-argument calls. Patch-release metadata documents the API change.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 20ccf

This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant SolidOrVueLink
  participant RouterCore
  participant preloadClientRoute
  participant RouteMatcher
  SolidOrVueLink->>RouterCore: preloadRoute(options)
  RouterCore->>preloadClientRoute: pass router and options
  preloadClientRoute->>RouterCore: build location from options
  preloadClientRoute->>RouteMatcher: match location and preload resources
  RouteMatcher-->>preloadClientRoute: matches or materialized redirect
  preloadClientRoute->>RouteMatcher: follow eligible redirect
  preloadClientRoute-->>RouterCore: return matches or undefined
  RouterCore-->>SolidOrVueLink: resolve or log preload error
Loading

Suggested reviewers: sheraff

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (1 skipped: 1 unsupported.) 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 summarizes the main change: removing prebuilt preload locations from the router.
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 remove-builtlocation

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.

@nx-cloud

nx-cloud Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 20ccf36

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

☁️ Nx Cloud last updated this comment at 2026-08-20 21:10:31 UTC

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

3 package(s) bumped directly, 20 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/router-core 1.171.26 → 1.171.27 Changeset
@tanstack/solid-router 1.170.29 → 1.170.30 Changeset
@tanstack/vue-router 1.170.28 → 1.170.29 Changeset
@tanstack/react-router 1.170.31 → 1.170.32 Dependent
@tanstack/react-start 1.168.48 → 1.168.49 Dependent
@tanstack/react-start-client 1.168.29 → 1.168.30 Dependent
@tanstack/react-start-rsc 0.1.47 → 0.1.48 Dependent
@tanstack/react-start-server 1.167.36 → 1.167.37 Dependent
@tanstack/router-cli 1.167.32 → 1.167.33 Dependent
@tanstack/router-generator 1.167.32 → 1.167.33 Dependent
@tanstack/router-plugin 1.168.34 → 1.168.35 Dependent
@tanstack/router-vite-plugin 1.167.34 → 1.167.35 Dependent
@tanstack/solid-start 1.168.46 → 1.168.47 Dependent
@tanstack/solid-start-client 1.168.28 → 1.168.29 Dependent
@tanstack/solid-start-server 1.167.35 → 1.167.36 Dependent
@tanstack/start-client-core 1.170.26 → 1.170.27 Dependent
@tanstack/start-plugin-core 1.171.38 → 1.171.39 Dependent
@tanstack/start-server-core 1.169.30 → 1.169.31 Dependent
@tanstack/start-static-server-functions 1.167.31 → 1.167.32 Dependent
@tanstack/start-storage-context 1.167.28 → 1.167.29 Dependent
@tanstack/vue-start 1.168.45 → 1.168.46 Dependent
@tanstack/vue-start-client 1.167.31 → 1.167.32 Dependent
@tanstack/vue-start-server 1.167.35 → 1.167.36 Dependent

@pkg-pr-new

pkg-pr-new Bot commented Aug 20, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 20ccf36

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 4c8b42379501
  • Measured at: 2026-08-20T20:59:08.583Z
  • Baseline source: history:7557415669ca
  • 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.83 KiB -12 B (-0.01%) 83.69 KiB 262.73 KiB 72.88 KiB █▆▃▃▂▂▁▁▃▃▃▂
react-router.full 87.33 KiB -18 B (-0.02%) 87.19 KiB 274.44 KiB 76.13 KiB █▅▂▂▂▂▁▁▄▄▄▂
solid-router.minimal 33.19 KiB -5 B (-0.01%) 33.06 KiB 96.59 KiB 29.92 KiB ▇▄▁▁▁▁▇▇████
solid-router.full 38.02 KiB -19 B (-0.05%) 37.90 KiB 111.23 KiB 34.28 KiB ▅▄▁▁▁▁▆▆███▇
vue-router.minimal 49.52 KiB -21 B (-0.04%) 49.40 KiB 138.62 KiB 44.72 KiB █▄▁▁▁▁▁▁▄▄▄▂
vue-router.full 55.13 KiB -21 B (-0.04%) 55.00 KiB 156.83 KiB 49.62 KiB █▄▁▁▁▁▁▁▄▄▄▂
react-start.minimal 96.72 KiB -19 B (-0.02%) 96.58 KiB 304.99 KiB 83.71 KiB ▇▄▂▂▁▁▆▆███▇
react-start.deferred-hydration 97.45 KiB -14 B (-0.01%) 96.60 KiB 306.34 KiB 84.40 KiB ▇▅▂▂▁▁▆▆███▇
react-start.full 99.88 KiB -18 B (-0.02%) 99.74 KiB 314.72 KiB 86.46 KiB █▄▁▁▁▁▆▆███▇
react-start.rsbuild.minimal 100.04 KiB -37 B (-0.04%) 99.87 KiB 315.25 KiB 86.34 KiB ▅▅▂▂▁▁▄▄███▆
react-start.rsbuild.minimal-iife 100.44 KiB -37 B (-0.04%) 100.28 KiB 316.19 KiB 86.63 KiB ▅▅▂▂▁▁▄▄███▆
react-start.rsbuild.full 103.37 KiB -29 B (-0.03%) 103.19 KiB 325.35 KiB 89.16 KiB ▅▅▂▂▁▁▄▄███▆
solid-start.minimal 46.02 KiB -21 B (-0.04%) 45.89 KiB 137.69 KiB 40.88 KiB ▅▂▁▁▁▁▇▇███▇
solid-start.deferred-hydration 49.08 KiB -24 B (-0.05%) 45.95 KiB 145.14 KiB 43.84 KiB ▅▃▁▁▁▁▇▇███▇
solid-start.full 51.10 KiB -5 B (-0.01%) 50.98 KiB 153.07 KiB 45.28 KiB ▄▃▁▁▁▁▇▇████
vue-start.minimal 65.66 KiB -20 B (-0.03%) 65.54 KiB 189.47 KiB 58.36 KiB ▆▃▁▁▁▁▆▆███▇
vue-start.full 69.48 KiB -22 B (-0.03%) 69.36 KiB 201.77 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.

@codspeed-hq

codspeed-hq Bot commented Aug 20, 2026

Copy link
Copy Markdown

Merging this PR will regress 7 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

⚡ 13 improved benchmarks
❌ 7 regressed benchmarks
✅ 160 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server error-paths not-found (solid) 610.9 KB 814 KB -24.95%
Memory mem server error-paths redirect (react) 305.2 KB 360.1 KB -15.25%
Memory mem server server-fn-churn (vue) 323.3 KB 358.5 KB -9.82%
Memory mem server error-paths unmatched (vue) 584.7 KB 630.1 KB -7.22%
Simulation client-nested-params navigation loop (react) 211.1 ms 227.3 ms -7.11%
Memory mem server error-paths redirect (solid) 364 KB 383.5 KB -5.07%
Memory mem server peak-large-page (vue) 1 MB 1 MB -3.94%
Memory mem client unique-location-churn (solid) 278.7 KB 238.1 KB +17.05%
Memory mem client unique-location-churn (vue) 465.1 KB 420.1 KB +10.72%
Memory mem server error-paths not-found (react) 449.2 KB 413.3 KB +8.69%
Memory mem server request-churn (react) 712.1 KB 657.8 KB +8.26%
Memory mem server peak-large-page (solid) 1.2 MB 1.2 MB +7.05%
Simulation client-control-flow navigation loop (react) 171.7 ms 160.7 ms +6.85%
Memory mem client interrupted-navigations (vue) 381.8 KB 358.4 KB +6.53%
Memory mem server error-paths not-found (vue) 521.7 KB 493.3 KB +5.75%
Memory mem server request-churn (solid) 744.5 KB 714.1 KB +4.26%
Simulation client-async-pipeline navigation loop (react) 107.2 ms 102.9 ms +4.25%
Memory mem server error-paths unmatched (react) 444.2 KB 427.8 KB +3.83%
Memory mem server server-fn-churn (react) 393.8 KB 379.5 KB +3.76%
Memory mem server aborted-requests (vue) 1,040.7 KB 1,003.1 KB +3.75%

Tip

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


Comparing remove-builtlocation (20ccf36) with main (e9f63a6)

Open in CodSpeed

@schiller-manuel
schiller-manuel merged commit fa65287 into main Aug 20, 2026
25 of 26 checks passed
@schiller-manuel
schiller-manuel deleted the remove-builtlocation branch August 20, 2026 21:17
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