Skip to content

feat(theme/Link): support opt-out prefetch via route.prefetchLink - #3506

Merged
SoonIter merged 1 commit into
mainfrom
feat/router-data-mode-page-data
Jul 8, 2026
Merged

SoonIter merged 1 commit into
mainfrom
feat/router-data-mode-page-data

Conversation

@SoonIter

@SoonIter SoonIter commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds route.prefetchLink so users can opt out of Rspress' default internal-link route prefetching. Prefetching remains enabled by default as a navigation performance optimization, while setting it to false disables the runtime link prefetch behavior. The English and Chinese config docs and 2.0 blog now describe how link prefetching works with the default dev.lazyCompilation behavior in development.

Related Issue

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings July 8, 2026 07:35
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Deploying rspress-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 17652b6
Status: ✅  Deploy successful!
Preview URL: https://bb2b0d6d.rspress-v2.pages.dev
Branch Preview URL: https://feat-router-data-mode-page-d.rspress-v2.pages.dev

View logs

Copilot AI 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.

Pull request overview

Adds a new route.prefetchLink config option to let users opt out of Rspress’ internal-link route prefetching (hover/touch), while keeping prefetching enabled by default for navigation performance.

Changes:

  • Extend shared config typings with route.prefetchLink?: boolean.
  • Gate runtime preloadLink() so it becomes a no-op when route.prefetchLink === false.
  • Add unit coverage for the new behavior and document the option in both EN/ZH config docs (including the dev.lazyCompilation side effect).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
website/docs/zh/api/config/config-basic.mdx Documents route.prefetchLink in Chinese, including dev lazyCompilation behavior and an example config.
website/docs/en/api/config/config-basic.mdx Documents route.prefetchLink in English, including dev lazyCompilation behavior and an example config.
packages/shared/src/types/index.ts Adds prefetchLink?: boolean to RouteOptions typings with default semantics.
packages/core/src/runtime/route.ts Disables preloadLink() when siteData.route.prefetchLink is explicitly false.
packages/core/src/runtime/route.test.ts Adds tests verifying default preloading and the opt-out behavior via route.prefetchLink.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SoonIter
SoonIter force-pushed the feat/router-data-mode-page-data branch 9 times, most recently from 52ef10d to b408847 Compare July 8, 2026 07:59
@SoonIter SoonIter changed the title feat(core): support disabling link prefetch feat(core): support opt-out prefetch via route.prefetchLink Jul 8, 2026
@SoonIter SoonIter changed the title feat(core): support opt-out prefetch via route.prefetchLink feat(theme/Link): support opt-out prefetch via route.prefetchLink Jul 8, 2026
@SoonIter
SoonIter force-pushed the feat/router-data-mode-page-data branch from b408847 to a4012f6 Compare July 8, 2026 08:07
@SoonIter SoonIter changed the title feat(theme/Link): support opt-out prefetch via route.prefetchLink feat(core): support disabling link prefetch Jul 8, 2026
@SoonIter
SoonIter force-pushed the feat/router-data-mode-page-data branch from a4012f6 to f493d06 Compare July 8, 2026 08:45
@SoonIter
SoonIter force-pushed the feat/router-data-mode-page-data branch from f493d06 to 17652b6 Compare July 8, 2026 08:46
@SoonIter SoonIter changed the title feat(core): support disabling link prefetch feat(theme/Link): support opt-out prefetch via route.prefetchLink Jul 8, 2026
@SoonIter
SoonIter requested a review from Timeless0911 July 8, 2026 08:53
@SoonIter
SoonIter enabled auto-merge (squash) July 8, 2026 08:53
@SoonIter
SoonIter merged commit 4a1c6c3 into main Jul 8, 2026
7 checks passed
@SoonIter
SoonIter deleted the feat/router-data-mode-page-data branch July 8, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants