Repository navigation
feat(theme/Link): support opt-out prefetch via route.prefetchLink - #3506
Merged
Merged
Conversation
Deploying rspress-v2 with
|
| 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 |
Contributor
There was a problem hiding this comment.
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 whenroute.prefetchLink === false. - Add unit coverage for the new behavior and document the option in both EN/ZH config docs (including the
dev.lazyCompilationside 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
force-pushed
the
feat/router-data-mode-page-data
branch
9 times, most recently
from
July 8, 2026 07:59
52ef10d to
b408847
Compare
route.prefetchLink
route.prefetchLinkroute.prefetchLink
SoonIter
force-pushed
the
feat/router-data-mode-page-data
branch
from
July 8, 2026 08:07
b408847 to
a4012f6
Compare
route.prefetchLink
SoonIter
force-pushed
the
feat/router-data-mode-page-data
branch
from
July 8, 2026 08:45
a4012f6 to
f493d06
Compare
SoonIter
force-pushed
the
feat/router-data-mode-page-data
branch
from
July 8, 2026 08:46
f493d06 to
17652b6
Compare
route.prefetchLink
SoonIter
enabled auto-merge (squash)
July 8, 2026 08:53
Timeless0911
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds
route.prefetchLinkso users can opt out of Rspress' default internal-link route prefetching. Prefetching remains enabled by default as a navigation performance optimization, while setting it tofalsedisables the runtime link prefetch behavior. The English and Chinese config docs and 2.0 blog now describe how link prefetching works with the defaultdev.lazyCompilationbehavior in development.Related Issue
N/A
Checklist