From 89821fada9486c6d0f38a2903b284aa04a855833 Mon Sep 17 00:00:00 2001 From: Marc LeBlanc <7050295+marcleblanc2@users.noreply.github.com> Date: Wed, 16 Sep 2026 18:13:34 -0600 Subject: [PATCH] fix: do not prefetch external sidebar links 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//https://... on versioned docs. Amp-Thread-ID: https://ampcode.com/threads/T-01a0ac9d-704f-73fe-8211-1b3e5840969f Co-authored-by: Amp --- src/components/Navigation.tsx | 2 +- src/components/NavigationLink.tsx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index d6b5b9e58..a0efeee71 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -97,7 +97,7 @@ export function Navigation({ // Prepends version (if any) to the link path const prependVersion = (path: string) => { - return version ? `/v/${version}${path}` : path; + return version && path.startsWith('/') ? `/v/${version}${path}` : path; }; // Handle versions diff --git a/src/components/NavigationLink.tsx b/src/components/NavigationLink.tsx index 0fb3556d8..c3b833f95 100644 --- a/src/components/NavigationLink.tsx +++ b/src/components/NavigationLink.tsx @@ -13,6 +13,14 @@ export function NavigationLink(props: NavigationLinkProps) { const [hasIntent, setHasIntent] = useState(false); const markIntent = () => setHasIntent(true); + // next/link treats an absolute URL on our own origin (sourcegraph.com/pricing) + // as an app route and prefetches the marketing page's HTML. Plain anchors + // for anything with a scheme. + if (typeof props.href === 'string' && /^https?:\/\//.test(props.href)) { + const {href, ...anchorProps} = props; + return ; + } + return (