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-manuelschiller-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

coderabbitaiBot 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 nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly summarizes the main change: removing prebuilt preload locations from the router.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck 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-cloudBot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 20ccf36

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded11m 51sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded2m 6sView ↗

☁️ 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

PackageVersionReason
@tanstack/router-core1.171.26 → 1.171.27Changeset
@tanstack/solid-router1.170.29 → 1.170.30Changeset
@tanstack/vue-router1.170.28 → 1.170.29Changeset
@tanstack/react-router1.170.31 → 1.170.32Dependent
@tanstack/react-start1.168.48 → 1.168.49Dependent
@tanstack/react-start-client1.168.29 → 1.168.30Dependent
@tanstack/react-start-rsc0.1.47 → 0.1.48Dependent
@tanstack/react-start-server1.167.36 → 1.167.37Dependent
@tanstack/router-cli1.167.32 → 1.167.33Dependent
@tanstack/router-generator1.167.32 → 1.167.33Dependent
@tanstack/router-plugin1.168.34 → 1.168.35Dependent
@tanstack/router-vite-plugin1.167.34 → 1.167.35Dependent
@tanstack/solid-start1.168.46 → 1.168.47Dependent
@tanstack/solid-start-client1.168.28 → 1.168.29Dependent
@tanstack/solid-start-server1.167.35 → 1.167.36Dependent
@tanstack/start-client-core1.170.26 → 1.170.27Dependent
@tanstack/start-plugin-core1.171.38 → 1.171.39Dependent
@tanstack/start-server-core1.169.30 → 1.169.31Dependent
@tanstack/start-static-server-functions1.167.31 → 1.167.32Dependent
@tanstack/start-storage-context1.167.28 → 1.167.29Dependent
@tanstack/vue-start1.168.45 → 1.168.46Dependent
@tanstack/vue-start-client1.167.31 → 1.167.32Dependent
@tanstack/vue-start-server1.167.35 → 1.167.36Dependent

@pkg-pr-new

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:

ScenarioCurrent (gzip)Delta vs baselineInitial gzipRawBrotliTrend
react-router.minimal83.83 KiB-12 B (-0.01%)83.69 KiB262.73 KiB72.88 KiB█▆▃▃▂▂▁▁▃▃▃▂
react-router.full87.33 KiB-18 B (-0.02%)87.19 KiB274.44 KiB76.13 KiB█▅▂▂▂▂▁▁▄▄▄▂
solid-router.minimal33.19 KiB-5 B (-0.01%)33.06 KiB96.59 KiB29.92 KiB▇▄▁▁▁▁▇▇████
solid-router.full38.02 KiB-19 B (-0.05%)37.90 KiB111.23 KiB34.28 KiB▅▄▁▁▁▁▆▆███▇
vue-router.minimal49.52 KiB-21 B (-0.04%)49.40 KiB138.62 KiB44.72 KiB█▄▁▁▁▁▁▁▄▄▄▂
vue-router.full55.13 KiB-21 B (-0.04%)55.00 KiB156.83 KiB49.62 KiB█▄▁▁▁▁▁▁▄▄▄▂
react-start.minimal96.72 KiB-19 B (-0.02%)96.58 KiB304.99 KiB83.71 KiB▇▄▂▂▁▁▆▆███▇
react-start.deferred-hydration97.45 KiB-14 B (-0.01%)96.60 KiB306.34 KiB84.40 KiB▇▅▂▂▁▁▆▆███▇
react-start.full99.88 KiB-18 B (-0.02%)99.74 KiB314.72 KiB86.46 KiB█▄▁▁▁▁▆▆███▇
react-start.rsbuild.minimal100.04 KiB-37 B (-0.04%)99.87 KiB315.25 KiB86.34 KiB▅▅▂▂▁▁▄▄███▆
react-start.rsbuild.minimal-iife100.44 KiB-37 B (-0.04%)100.28 KiB316.19 KiB86.63 KiB▅▅▂▂▁▁▄▄███▆
react-start.rsbuild.full103.37 KiB-29 B (-0.03%)103.19 KiB325.35 KiB89.16 KiB▅▅▂▂▁▁▄▄███▆
solid-start.minimal46.02 KiB-21 B (-0.04%)45.89 KiB137.69 KiB40.88 KiB▅▂▁▁▁▁▇▇███▇
solid-start.deferred-hydration49.08 KiB-24 B (-0.05%)45.95 KiB145.14 KiB43.84 KiB▅▃▁▁▁▁▇▇███▇
solid-start.full51.10 KiB-5 B (-0.01%)50.98 KiB153.07 KiB45.28 KiB▄▃▁▁▁▁▇▇████
vue-start.minimal65.66 KiB-20 B (-0.03%)65.54 KiB189.47 KiB58.36 KiB▆▃▁▁▁▁▆▆███▇
vue-start.full69.48 KiB-22 B (-0.03%)69.36 KiB201.77 KiB61.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

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

ModeBenchmarkBASEHEADEfficiency
Memorymem server error-paths not-found (solid)610.9 KB814 KB-24.95%
Memorymem server error-paths redirect (react)305.2 KB360.1 KB-15.25%
Memorymem server server-fn-churn (vue)323.3 KB358.5 KB-9.82%
Memorymem server error-paths unmatched (vue)584.7 KB630.1 KB-7.22%
Simulationclient-nested-params navigation loop (react)211.1 ms227.3 ms-7.11%
Memorymem server error-paths redirect (solid)364 KB383.5 KB-5.07%
Memorymem server peak-large-page (vue)1 MB1 MB-3.94%
Memorymem client unique-location-churn (solid)278.7 KB238.1 KB+17.05%
Memorymem client unique-location-churn (vue)465.1 KB420.1 KB+10.72%
Memorymem server error-paths not-found (react)449.2 KB413.3 KB+8.69%
Memorymem server request-churn (react)712.1 KB657.8 KB+8.26%
Memorymem server peak-large-page (solid)1.2 MB1.2 MB+7.05%
Simulationclient-control-flow navigation loop (react)171.7 ms160.7 ms+6.85%
Memorymem client interrupted-navigations (vue)381.8 KB358.4 KB+6.53%
Memorymem server error-paths not-found (vue)521.7 KB493.3 KB+5.75%
Memorymem server request-churn (solid)744.5 KB714.1 KB+4.26%
Simulationclient-async-pipeline navigation loop (react)107.2 ms102.9 ms+4.25%
Memorymem server error-paths unmatched (react)444.2 KB427.8 KB+3.83%
Memorymem server server-fn-churn (react)393.8 KB379.5 KB+3.76%
Memorymem server aborted-requests (vue)1,040.7 KB1,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 mainAug 20, 2026
25 of 26 checks passed
@schiller-manuel
schiller-manuel deleted the remove-builtlocation branch August 20, 2026 21:17
This was referenced Aug 20, 2026
Sign up for freeto 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

@schiller-manuel