fix(router): cancel pending link preload before navigation #8579
main fromrefs/pull/8579/head·merged by Sheraff(GitHub profile, opens in a new tab) 🎯 Changes#
Clicking a link before its delayed preload fires can start navigation while leaving the preload timer pending. Cancel that timer immediately before navigation in the React, Solid, and Vue adapters, reusing their existing cancellation paths.
✅ 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.
No regression test was added and no tests, checks, or benchmarks were run, as requested.
🚀 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#
- Bug Fixes
- Link navigation now cancels pending preload timers in React and Solid, preventing preloads from continuing after navigation begins.
- In Vue, eligible internal-link clicks now enqueue a preload after the browser’s default action is prevented, before navigation proceeds.
- 1
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: solid-router
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-router
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: TanStack/router/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
0b2d81c5-b4ec-4ead-9018-c2bc69f657dd📥 Commits
Reviewing files that changed from the base of the PR and between 57e126e99dbd86f735ead2ba98ba5e98ef0cc668 and 2e185d7fec62205b0ac768a0bb7ad4c0c176fecd.
📒 Files selected for processing (4)
.changeset/quick-links-cancel.mdpackages/react-router/src/link.tsxpackages/solid-router/src/link.tsxpackages/vue-router/src/link.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
Link click handlers in the React, Solid, and Vue routers now update preload handling before navigation. A changeset marks all three packages for patch releases.
Changes#
Link preload handling
Layer / File(s) Summary Preload handling in link click handlers
packages/react-router/src/link.tsx,packages/solid-router/src/link.tsx,packages/vue-router/src/link.tsx,.changeset/quick-links-cancel.mdReact and Solid cancel pending preload timers before navigation. Vue enqueues preloading before navigation. The changeset marks all three router packages for patch releases. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
schiller-manuelMerge Risk: ⚪ Minimal · up to
2e185Eligible navigation now clears that link’s pending preload timer in React, Solid, and Vue. No material behavior issue remains that should block merging.
Architecture Summary#
Architecture risk: 🔵 Low · up to
2e185The change affects 3 systems.
Changed systems:
packages/react-router,packages/solid-router,packages/vue-routerArchitecture concerns No architecture-level concerns identified.
Review details
Systems and components
- observed — packages/react-router (library) was modified; 1 changed file maps to changed impact.
- observed — packages/solid-router (library) was modified; 1 changed file maps to changed impact.
- observed — packages/vue-router (library) was modified; 1 changed file maps to changed impact.
Before / after behavior
- observed — Modified behavior in packages/react-router/src/link.tsx: The click handler now cancels a pending preload timer associated with the link before navigating.
- observed — Modified behavior in packages/solid-router/src/link.tsx: The qualifying click path now calls
cancelPreload(ref)before navigation; previously it left any pending preload timer scheduled. - observed — Modified behavior in packages/vue-router/src/link.tsx: The eligible internal-link click path now enqueues preloading after preventing the default action and before navigating; this call was absent previously.
- observed — Modified behavior in .changeset/quick-links-cancel.md: Adds a Changeset front matter entry marking the React, Solid, and Vue router packages for patch releases, plus a description of canceling pending link preload timers when navigation starts.
🚥 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 3 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (4 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely describes the main change: canceling pending link preload timers before navigation. Description check ✅ Passed The description explains the change and motivation, includes the required sections, records that no tests were run, and confirms that a changeset was generated. The unchecked contributing-guide item i… 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. Full details: Docstring Coverage
Explanation
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 3 functions across 3 files. (1 skipped: 1 unsupported.)
- Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks 💡
- Commit to this branch
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Autopilot is currently an internal CodeRabbit preview.
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.
Comment `@coderabbitai help` to get the list of available commands.🚀 Changeset Version Preview#
3 package(s) bumped directly, 10 bumped as dependents.
🟩 Patch bumps#
Package Version Reason @tanstack/react-router1.170.41 → 1.170.42 Changeset @tanstack/solid-router1.170.38 → 1.170.39 Changeset @tanstack/vue-router1.170.37 → 1.170.38 Changeset @tanstack/react-start1.168.60 → 1.168.61 Dependent @tanstack/react-start-client1.168.39 → 1.168.40 Dependent @tanstack/react-start-rsc0.1.59 → 0.1.60 Dependent @tanstack/react-start-server1.167.46 → 1.167.47 Dependent @tanstack/solid-start1.168.57 → 1.168.58 Dependent @tanstack/solid-start-client1.168.37 → 1.168.38 Dependent @tanstack/solid-start-server1.167.44 → 1.167.45 Dependent @tanstack/vue-start1.168.56 → 1.168.57 Dependent @tanstack/vue-start-client1.167.40 → 1.167.41 Dependent @tanstack/vue-start-server1.167.44 → 1.167.45 Dependent Bundle Size Benchmarks#
- Commit:
438114eb4419 - Measured at:
2026-10-01T11:32:45.929Z - Baseline source:
history:57e126e99dbd - Dashboard: bundle-size history
The following scenarios have bundle-size changes compared with the baseline:
Scenario Current (gzip) Initial (gzip) Raw Brotli Trend react-router.minimal84.0 KiB
+1 B83.8 KiB
+3 B261.4 KiB
+6 B73.2 KiB
-133 B▃▃▁▁▁▇▇▇████
react-router.full87.5 KiB
-2 B87.4 KiB
0 B273.3 KiB
+6 B76.3 KiB
+38 B▂▂▂▂▁▇▇▇███▇
solid-router.minimal33.5 KiB
0 B33.4 KiB
+2 B96.0 KiB
+6 B30.4 KiB
+63 B▁▁█████████
solid-router.full38.4 KiB
+3 B38.3 KiB
+3 B110.8 KiB
+6 B34.6 KiB
-29 B██▁▁▁▁▁▁▁▁▁▅
vue-router.minimal49.4 KiB
+5 B49.3 KiB
+3 B136.8 KiB
+4 B44.7 KiB
-58 B▁▁▄▄▄▄▄▄▆▆▆█
vue-router.full55.0 KiB
+4 B54.9 KiB
+2 B155.1 KiB
+4 B49.7 KiB
+17 B▅▅▁▁▁▁▁▁▅▅▅█
react-start.minimal96.8 KiB
0 B96.7 KiB
+2 B302.4 KiB
+6 B84.0 KiB
+20 B▁▇█████████
react-start.query-integration104.2 KiB
+2 B104.1 KiB
+1 B329.0 KiB
+6 B90.5 KiB
+12 B▁███████████
react-start.deferred-hydration97.5 KiB
-7 B96.7 KiB
+2 B303.7 KiB
+6 B84.7 KiB
-112 B▁▇██████████
react-start.full99.9 KiB
-2 B99.8 KiB
+1 B312.1 KiB
+5 B86.8 KiB
-13 B▁▇██▇███████
react-start.rsbuild.minimal100.3 KiB
+1 B100.2 KiB
+1 B313.4 KiB
+6 B86.5 KiB
-213 B▁███████████
react-start.rsbuild.minimal-iife100.7 KiB
0 B100.6 KiB
0 B314.4 KiB
+6 B86.9 KiB
-52 B▁██████████
react-start.rsbuild.full103.6 KiB
+1 B103.4 KiB
+1 B323.5 KiB
+6 B89.3 KiB
-67 B▁███████████
solid-start.minimal46.4 KiB
+2 B46.3 KiB
+4 B135.8 KiB
+6 B41.3 KiB
-14 B▁███████████
solid-start.deferred-hydration49.4 KiB
+4 B46.3 KiB
+5 B143.2 KiB
+6 B44.0 KiB
-43 B▁███████████
solid-start.full51.5 KiB
+1 B51.3 KiB
+3 B151.2 KiB
+6 B45.6 KiB
-21 B▁███████████
vue-start.minimal65.5 KiB
+3 B65.4 KiB
+3 B186.2 KiB
+4 B58.4 KiB
+41 B▁███████████
vue-start.full69.3 KiB
+1 B69.2 KiB
+3 B198.6 KiB
+4 B61.8 KiB
+52 B▁███████████
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.
- Commit:
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@8579@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@8579@tanstack/eslint-plugin-start
npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8579@tanstack/history
npm i https://pkg.pr.new/@tanstack/history@8579@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@8579@tanstack/react-router
npm i https://pkg.pr.new/@tanstack/react-router@8579@tanstack/react-router-devtools
npm i https://pkg.pr.new/@tanstack/react-router-devtools@8579@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@8579@tanstack/react-start
npm i https://pkg.pr.new/@tanstack/react-start@8579@tanstack/react-start-client
npm i https://pkg.pr.new/@tanstack/react-start-client@8579@tanstack/react-start-rsc
npm i https://pkg.pr.new/@tanstack/react-start-rsc@8579@tanstack/react-start-server
npm i https://pkg.pr.new/@tanstack/react-start-server@8579@tanstack/router-cli
npm i https://pkg.pr.new/@tanstack/router-cli@8579@tanstack/router-core
npm i https://pkg.pr.new/@tanstack/router-core@8579@tanstack/router-devtools
npm i https://pkg.pr.new/@tanstack/router-devtools@8579@tanstack/router-devtools-core
npm i https://pkg.pr.new/@tanstack/router-devtools-core@8579@tanstack/router-generator
npm i https://pkg.pr.new/@tanstack/router-generator@8579@tanstack/router-plugin
npm i https://pkg.pr.new/@tanstack/router-plugin@8579@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@8579@tanstack/router-utils
npm i https://pkg.pr.new/@tanstack/router-utils@8579@tanstack/router-vite-plugin
npm i https://pkg.pr.new/@tanstack/router-vite-plugin@8579@tanstack/solid-router
npm i https://pkg.pr.new/@tanstack/solid-router@8579@tanstack/solid-router-devtools
npm i https://pkg.pr.new/@tanstack/solid-router-devtools@8579@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8579@tanstack/solid-start
npm i https://pkg.pr.new/@tanstack/solid-start@8579@tanstack/solid-start-client
npm i https://pkg.pr.new/@tanstack/solid-start-client@8579@tanstack/solid-start-server
npm i https://pkg.pr.new/@tanstack/solid-start-server@8579@tanstack/start-client-core
npm i https://pkg.pr.new/@tanstack/start-client-core@8579@tanstack/start-fn-stubs
npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8579@tanstack/start-plugin-core
npm i https://pkg.pr.new/@tanstack/start-plugin-core@8579@tanstack/start-server-core
npm i https://pkg.pr.new/@tanstack/start-server-core@8579@tanstack/start-static-server-functions
npm i https://pkg.pr.new/@tanstack/start-static-server-functions@8579@tanstack/start-storage-context
npm i https://pkg.pr.new/@tanstack/start-storage-context@8579@tanstack/valibot-adapter
npm i https://pkg.pr.new/@tanstack/valibot-adapter@8579@tanstack/virtual-file-routes
npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8579@tanstack/vue-router
npm i https://pkg.pr.new/@tanstack/vue-router@8579@tanstack/vue-router-devtools
npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8579@tanstack/vue-router-ssr-query
npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8579@tanstack/vue-start
npm i https://pkg.pr.new/@tanstack/vue-start@8579@tanstack/vue-start-client
npm i https://pkg.pr.new/@tanstack/vue-start-client@8579@tanstack/vue-start-server
npm i https://pkg.pr.new/@tanstack/vue-start-server@8579@tanstack/zod-adapter
npm i https://pkg.pr.new/@tanstack/zod-adapter@8579commit:
2e185d7Merging this PR will degrade performance by 31.71%#
:warning: Different runtime environments detected
Some benchmarks with significant performance changes were compared across different runtime environments, which may affect the accuracy of the results.
❌ 2 (👁 2)regressed benchmarks✅ 189untouched benchmarks⏩ 3skipped benchmarks1Performance Changes#
Mode Benchmark BASEHEADEfficiency 👁 Simulation hydrate restored route state and mixed Links (react)212.4 ms 248.2 ms -14.4% 👁 Memory mem server streaming-peak chunked (react)349.7 KB 642 KB -45.53%
Comparingcodex/cancel-link-preload-timeout(2e185d7) withmain(57e126e)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. ↩
-
Sheraff(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
View your CI Pipeline Execution ↗ for commit 2e185d7fec62205b0ac768a0bb7ad4c0c176fecd
nx affected --targets=test:eslint,test:unit,tes...nx run-many --target=build --exclude=examples/*...☁️ Nx Cloud last updated this comment at
2026-10-01 11:42:37UTC