Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next/Link is prefetching the current page being viewed #70535

Open
dannytlake opened this issue Sep 26, 2024 · 1 comment · May be fixed by #70650
Open

Next/Link is prefetching the current page being viewed #70535

dannytlake opened this issue Sep 26, 2024 · 1 comment · May be fixed by #70650
Labels
bug Issue was opened via the bug report template. Navigation Related to Next.js linking (e.g., <Link>) and navigation. Performance Anything with regards to Next.js performance.

Comments

@dannytlake
Copy link

dannytlake commented Sep 26, 2024

Link to the code that reproduces this issue

https://github.com/dannytlake/next-prefetch-bug-current-route

To Reproduce

Start in production mode, view network tab.

  • pnpm build && pnpm start
  • visit http://localhost:3000
  • open network tab
  • Click on the Page2 link.
  • Refresh the browser
  • See the prefetch request to page2_rsc - this should not be occurring

image

Current vs. Expected behavior

Current: The Next/Link component is prefetching the current page being viewed, unnecessarily consuming network + cpu resources

Expected: The Next/Link component should not prefetch links pointing to the current page being viewed.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 20.16.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 8.15.9
Relevant Packages:
  next: 15.0.0-canary.171 // Latest available version is detected (15.0.0-canary.171).
  eslint-config-next: 14.2.7
  react: 19.0.0-beta-26f2496093-20240514
  react-dom: 19.0.0-beta-26f2496093-20240514
  typescript: 5.5.4
Next.js Config:

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

Navigation, Performance

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

next start (local), Vercel (Deployed)

Additional context

This bug also occurs in next@14 (v14.2.13 at time of writing)

@dannytlake dannytlake added the bug Issue was opened via the bug report template. label Sep 26, 2024
@github-actions github-actions bot added Navigation Related to Next.js linking (e.g., <Link>) and navigation. Performance Anything with regards to Next.js performance. labels Sep 26, 2024
@samcx
Copy link
Member

samcx commented Oct 1, 2024

@dannytlake Thank you for submitting an issue!

Our team is already looking to fix this issue :frog-eyes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Navigation Related to Next.js linking (e.g., <Link>) and navigation. Performance Anything with regards to Next.js performance.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants