nextjs - ✅(Solved) Fix <Link> breaks with different values of `prefetch` pointing to the same page (under Static Export) [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#88032Fetched 2026-04-08 02:05:37
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2issue_type_added ×1subscribed ×1

Fix Action

Fixed

PR fix notes

PR #88114: fix: Full prefetch strategy in export ouput mode

Description (problem / solution / changelog)

  • Fix navigation failure when multiple Link components with different prefetch values point to the same href in static export mode
  • fetchSegmentPrefetchesUsingDynamicRequest now fetches from __next._full.txt instead of the page URL in output export mode

Closes #88032

Changed files

  • packages/next/src/client/components/segment-cache/cache.ts (modified, +11/-1)
  • test/e2e/app-dir/segment-cache/export/app/blog/[slug]/page.tsx (added, +20/-0)
  • test/e2e/app-dir/segment-cache/export/app/page.tsx (modified, +12/-0)
  • test/e2e/app-dir/segment-cache/export/components/multi-prefetch-links.tsx (added, +39/-0)
  • test/e2e/app-dir/segment-cache/export/segment-cache-output-export.test.ts (modified, +85/-0)

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.1-canary.10 // Latest available version is detected (16.1.1-canary.10).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: export
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/nostalgic-night-tzt6qt

To Reproduce

Requirements:

  • static export
  • production mode (happen only on the served build output)
  • multiple <Link> components, with same href but one have prefetch=true while another have not (auto).

Observe:

  • some of the links do nothing when you click on them, all ways to soft navigate to that page is not working.

To use the reproduction:

  1. This is a problem with prefetching, so make sure to run pnpm build && pnpm start to start the production server and observe.
  2. open blog page, if you click on the links, some of them will simply do nothing.

Current vs. Expected behavior

Currently, likely due to race conditions, the links won't be functioning:

https://github.com/user-attachments/assets/a33bce75-8e71-4908-9ccb-efd06fc3f299

The navigation shouldn't break with different prefetch values, the handling of race conditions & client-side route cache may be the main reason of this bug.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.19
  pnpm: 8.15.6
Relevant Packages:
  next: 16.1.1-canary.10 // Latest available version is detected (16.1.1-canary.10).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: export

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

extent analysis

TL;DR

The issue can likely be resolved by ensuring consistent prefetching behavior across all <Link> components with the same href, potentially by setting prefetch to a consistent value or implementing a custom prefetching strategy.

Guidance

  • Verify that the issue is indeed related to prefetching by testing with consistent prefetch values across all <Link> components.
  • Check the Next.js documentation for any known issues or limitations related to prefetching and client-side route caching.
  • Consider implementing a custom prefetching strategy to handle race conditions and ensure consistent navigation behavior.
  • Test the application with different prefetch values to determine the optimal configuration for the specific use case.

Example

No code example is provided as the issue is more related to configuration and behavior rather than a specific code snippet.

Notes

The issue seems to be specific to the production build output and may be related to the interaction between Next.js, React, and the prefetching mechanism. Further investigation and testing are necessary to determine the root cause and optimal solution.

Recommendation

Apply a workaround by setting prefetch to a consistent value across all <Link> components, as this may help mitigate the issue and ensure consistent navigation behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix <Link> breaks with different values of `prefetch` pointing to the same page (under Static Export) [1 pull requests, 1 participants]