Skip to content

feat(pages): skip Link prefetching on Save-Data and slow connections - #702

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
yangshun:claude/link-prefetch-save-data-f72978
Nov 4, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
yangshun:claude/link-prefetch-save-data-f72978

Conversation

@yangshun

@yangshun yangshun commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Link's automatic prefetching (every strategy, including prefetch.defaultStrategy) now skips while the browser reports data saver or a 2G connection. Only Chromium reports these, so other browsers keep prefetching. An explicit router.prefetch() still runs.

Precedent: Nuxt skips every NuxtLink prefetch on the same check. Astro skips them too, but still prefetches on tap.

Tests: prefetchLink unit tests for data saver, 2G/slow-2G, faster or unreported connections, and a connection change between prefetches.

🤖 Generated with Claude Code

cpojer
cpojer previously approved these changes Nov 4, 2026

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Link's automatic prefetch (every strategy, including the app-wide
default) now does nothing while navigator.connection reports saveData or
a 2g/slow-2g effectiveType. The connection is read on each prefetch.
Browsers without navigator.connection keep prefetching, and calling
router.prefetch() directly is unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cpojer
cpojer force-pushed the claude/link-prefetch-save-data-f72978 branch from e9a4800 to 138fc26 Compare November 4, 2026 08:34
@cpojer
cpojer merged commit b6f07f0 into voidzero-dev:main Nov 4, 2026
17 checks passed
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.

2 participants