Skip to content
Source
Sign inSign up
TanStack/router

fix(router): cancel pending link preload before navigation #8579

MergedSheraff(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/8579/headmerged 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

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-router

    3. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-router

    4. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 2e185d7fec62205b0ac768a0bb7ad4c0c176fecd

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

      ☁️ Nx Cloud last updated this comment at 2026-10-01 11:42:37 UTC

    5. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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.md
      • packages/react-router/src/link.tsx
      • packages/solid-router/src/link.tsx
      • packages/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.md
      React 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-manuel

      Merge Risk: ⚪ Minimal · up to 2e185

      Eligible 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 2e185

      The change affects 3 systems.

      Changed systems: packages/react-router, packages/solid-router, packages/vue-router

      Architecture 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 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 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 nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely describes the main change: canceling pending link preload timers before navigation.
      Description check✅ PassedThe 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✅ 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.
      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    6. 🚀 Changeset Version Preview

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

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/react-router1.170.41 → 1.170.42Changeset
      @tanstack/solid-router1.170.38 → 1.170.39Changeset
      @tanstack/vue-router1.170.37 → 1.170.38Changeset
      @tanstack/react-start1.168.60 → 1.168.61Dependent
      @tanstack/react-start-client1.168.39 → 1.168.40Dependent
      @tanstack/react-start-rsc0.1.59 → 0.1.60Dependent
      @tanstack/react-start-server1.167.46 → 1.167.47Dependent
      @tanstack/solid-start1.168.57 → 1.168.58Dependent
      @tanstack/solid-start-client1.168.37 → 1.168.38Dependent
      @tanstack/solid-start-server1.167.44 → 1.167.45Dependent
      @tanstack/vue-start1.168.56 → 1.168.57Dependent
      @tanstack/vue-start-client1.167.40 → 1.167.41Dependent
      @tanstack/vue-start-server1.167.44 → 1.167.45Dependent
    7. 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:

      ScenarioCurrent (gzip)Initial (gzip)RawBrotliTrend
      react-router.minimal84.0 KiB
      +1 B
      83.8 KiB
      +3 B
      261.4 KiB
      +6 B
      73.2 KiB
      -133 B
      ▃▃▁▁▁▇▇▇████
      react-router.full87.5 KiB
      -2 B
      87.4 KiB
      0 B
      273.3 KiB
      +6 B
      76.3 KiB
      +38 B
      ▂▂▂▂▁▇▇▇███▇
      solid-router.minimal33.5 KiB
      0 B
      33.4 KiB
      +2 B
      96.0 KiB
      +6 B
      30.4 KiB
      +63 B
      ▁▁█████████
      solid-router.full38.4 KiB
      +3 B
      38.3 KiB
      +3 B
      110.8 KiB
      +6 B
      34.6 KiB
      -29 B
      ██▁▁▁▁▁▁▁▁▁▅
      vue-router.minimal49.4 KiB
      +5 B
      49.3 KiB
      +3 B
      136.8 KiB
      +4 B
      44.7 KiB
      -58 B
      ▁▁▄▄▄▄▄▄▆▆▆█
      vue-router.full55.0 KiB
      +4 B
      54.9 KiB
      +2 B
      155.1 KiB
      +4 B
      49.7 KiB
      +17 B
      ▅▅▁▁▁▁▁▁▅▅▅█
      react-start.minimal96.8 KiB
      0 B
      96.7 KiB
      +2 B
      302.4 KiB
      +6 B
      84.0 KiB
      +20 B
      ▁▇█████████
      react-start.query-integration104.2 KiB
      +2 B
      104.1 KiB
      +1 B
      329.0 KiB
      +6 B
      90.5 KiB
      +12 B
      ▁███████████
      react-start.deferred-hydration97.5 KiB
      -7 B
      96.7 KiB
      +2 B
      303.7 KiB
      +6 B
      84.7 KiB
      -112 B
      ▁▇██████████
      react-start.full99.9 KiB
      -2 B
      99.8 KiB
      +1 B
      312.1 KiB
      +5 B
      86.8 KiB
      -13 B
      ▁▇██▇███████
      react-start.rsbuild.minimal100.3 KiB
      +1 B
      100.2 KiB
      +1 B
      313.4 KiB
      +6 B
      86.5 KiB
      -213 B
      ▁███████████
      react-start.rsbuild.minimal-iife100.7 KiB
      0 B
      100.6 KiB
      0 B
      314.4 KiB
      +6 B
      86.9 KiB
      -52 B
      ▁██████████
      react-start.rsbuild.full103.6 KiB
      +1 B
      103.4 KiB
      +1 B
      323.5 KiB
      +6 B
      89.3 KiB
      -67 B
      ▁███████████
      solid-start.minimal46.4 KiB
      +2 B
      46.3 KiB
      +4 B
      135.8 KiB
      +6 B
      41.3 KiB
      -14 B
      ▁███████████
      solid-start.deferred-hydration49.4 KiB
      +4 B
      46.3 KiB
      +5 B
      143.2 KiB
      +6 B
      44.0 KiB
      -43 B
      ▁███████████
      solid-start.full51.5 KiB
      +1 B
      51.3 KiB
      +3 B
      151.2 KiB
      +6 B
      45.6 KiB
      -21 B
      ▁███████████
      vue-start.minimal65.5 KiB
      +3 B
      65.4 KiB
      +3 B
      186.2 KiB
      +4 B
      58.4 KiB
      +41 B
      ▁███████████
      vue-start.full69.3 KiB
      +1 B
      69.2 KiB
      +3 B
      198.6 KiB
      +4 B
      61.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.

    8. More templates

      @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@8579

      commit: 2e185d7

    9. codspeed[bot](GitHub profile, opens in a new tab)commented

      Merging 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.

      Open the report in CodSpeed to investigate

      ❌ 2 (👁 2) regressed benchmarks ✅ 189 untouched benchmarks ⏩ 3 skipped benchmarks1

      Performance Changes

      ModeBenchmarkBASEHEADEfficiency
      👁Simulationhydrate restored route state and mixed Links (react)212.4 ms248.2 ms-14.4%
      👁Memorymem server streaming-peak chunked (react)349.7 KB642 KB-45.53%

      Comparing codex/cancel-link-preload-timeout (2e185d7) with main (57e126e) Open in CodSpeed

      Footnotes

      1. 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. ↩

Sign in to join this conversation.