fix: do not prefetch external sidebar links - #1978
marcleblanc2 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The Pricing and Changelog entries point at https://sourcegraph.com/..., which next/link treats as an app route on our own origin, so every page load prefetched the marketing pricing page (65 KB of HTML). Render those as plain anchors, and stop prependVersion from turning them into /v/<version>/https://... on versioned docs. Amp-Thread-ID: https://ampcode.com/threads/T-01a0ac9d-704f-73fe-8211-1b3e5840969f Co-authored-by: Amp <amp@ampcode.com>
e46d73d to
32ea28e
Compare
4c29c24 to
89821fa
Compare
|
|
From the docs site audit (crawl of all 502 pages). Same root cause, one more instance outside this PR's files: the Changelog link in the desktop header ( |
Stacked on #1976 (
marc/perf/sidebar-prefetch); retarget tomainonce that merges.Problem
navigation.tshas Pricing and Changelog entries withhref: 'https://sourcegraph.com/...'.next/linktreats an absolute URL on the current origin as an app route, so every page load prefetched the marketing pricing page (65 KB of HTML in the HAR). On versioned docs,prependVersionalso turns them into/v/<version>/https://sourcegraph.com/pricing.Fix
NavigationLinkrenders a plain<a>for anyhttp(s)://href.prependVersiononly prefixes paths that start with/.Verification
tsc,pnpm lint,pnpm buildclean. On the preview, the Network tab should show no request tosourcegraph.com/pricingon page load, and the Pricing link should still navigate.