Skip to content
← All posts

Next.js Prefetching Is Real Work. Measure Whether It Pays Off.

Next.js prefetching can request route information before a visitor clicks a link. That can make navigation feel faster, but it can also transfer bytes and trigger server work for destinations the visitor never opens.

The right response is not to disable prefetching everywhere. Measure which prefetches improve real navigation and which ones create avoidable work.

A page visit is not a request count

Imagine a marketplace results page with many product links. A visitor may inspect the list and open one item. Depending on the framework version, route configuration, and prefetch behavior, the browser may have requested information for other destinations first.

This is a conceptual sequence, not a claim that every link produces a full server render. Next.js documents route-dependent behavior and controls in its prefetching guide.

Test a production build

Automatic prefetch behavior is designed around production behavior. A development server is not the right place to estimate the resulting hosting workload.

Use a small set of representative sessions: a visitor who scans and leaves, one who opens several products, and one who uses filters before choosing. Record the Network panel and correlate requests with runtime telemetry where available.

Keep direct documents, prefetched data, clicked navigation, images, and mutations separate. Counting all of them as “page views” makes the analysis difficult to use.

Ask whether the prefetched work was reused

For each candidate destination, compare the data requested before a click with the request needed after a click. Was the earlier work reused, partially reused, invalidated, or never needed?

A useful experiment measures both navigation latency and the additional resource use. Lower request counts alone are not a complete win if the important purchase flow becomes noticeably slower.

Conversely, an extremely fast click is not free if the application speculatively fetched many expensive private destinations to achieve it.

Next.js supports disabling prefetch on a link:

import Link from 'next/link';

export function LowIntentLink() {
  return (
    <Link href="/catalog/archive" prefetch={false}>
      Browse the full archive
    </Link>
  );
}

This is a targeted example, not a recommended setting for every catalog. A low-intent archive link and a primary next-step button can justify different behavior.

Test the same user journeys before and after the change. If you build a more selective interaction-based policy, verify keyboard and touch behavior as well as pointer interaction. Do not make an optimization that only works for mouse users.

Keep rendering free of unintended side effects

A route may be requested before an explicit visit. Do not make rendering perform a business mutation or count it as a confirmed user action merely because the server ran.

Record purchases, submissions, and similar events at their actual interaction or commit boundaries. Keep speculative work distinguishable in analytics so it does not inflate funnel numbers.

Optimize useful anticipation

Prefetching is valuable when it anticipates a likely next step at reasonable cost. It is less valuable when it expands a large graph of expensive possibilities with little reuse.

Start with one dense page, one link group, and one measurable journey. Keep the latency benefit where it matters, and remove speculative work where the evidence shows it is not helping.

About the author