From a3c860942fe32f8e9fab8c691e55f114dfd0df09 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Wed, 2 Sep 2026 16:38:31 +0000 Subject: [PATCH] Disable link prefetching site-wide Next's client router prefetches every visible link. In output: "export" mode that means a HEAD request to the page followed by a GET for its __next._tree.txt segment payload. Those payloads are not deployed (the .html route scheme forces scripts/fix-html-ext.mjs to move them aside), so every prefetch was two wasted requests, the second a 404. Every Fumadocs link renders through the framework Link from RootProvider, so supply one that forces prefetch={false}. Navigation still works: a click falls back to the full-page .txt payload as before. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01Rb8SXvBwzUXaUEQtYHrD9V --- components/provider.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/components/provider.tsx b/components/provider.tsx index 522282b..79bdaa5 100644 --- a/components/provider.tsx +++ b/components/provider.tsx @@ -1,8 +1,22 @@ 'use client'; import SearchDialog from '@/components/search'; import { RootProvider } from 'fumadocs-ui/provider/next'; -import { type ReactNode } from 'react'; +import NextLink from 'next/link'; +import { type ComponentProps, type ReactNode } from 'react'; + +// Every Fumadocs link (sidebar, page body, breadcrumb, prev/next footer) +// renders through the framework Link supplied here. Prefetching is disabled +// site-wide: this is a static export whose .html routes can't ship Next's +// per-segment payloads (see scripts/fix-html-ext.mjs), so each prefetch would +// only cost a HEAD to the page plus a 404 for its __next._tree.txt. +function Link({ href = '#', ...props }: ComponentProps<'a'> & { prefetch?: boolean }) { + return ; +} export function Provider({ children }: { children: ReactNode }) { - return {children}; + return ( + + {children} + + ); }