question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reuse prefetched next/link cache on hover

See original GitHub issue

Describe the feature you’d like to request

Idea: reduce the HTTP requests count that next/link generates when hovering over a link.

next-link-prefetch-on-hover

My thoughts:

  • skip prefetching on hover when the link has already been prefetched (prefetch=true/undefined on viewport)
  • do not repeat prefetch on hover after the previous one
  • do not call prefetch on hover when the same prefetch request is pending
  • there should be a way to disable it completely

Describe the solution you’d like

Respect next/link prefetched cache on hover.

Describe alternatives you’ve considered

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jettlovecommented, Sep 6, 2022

agree, nobody wants to DDOS their backend

0reactions
fitiskincommented, Sep 6, 2022

Actually, I am considering introducing a 10ms/20ms delay before prefetching (for onMouseEnter only, onTouchStart doesn’t need that).

@trompx has a similar idea

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reuse prefetched next/link cache on hover #40268 - GitHub
Respect next/link prefetched cache on hover. Describe alternatives you've considered. throttling; hover duration; other cache than next/link ...
Read more >
Show HN: Make your site's pages faster than instant in one ...
This is a clever trick (using mousedown to trigger a click), but breaks drag & dropping links, drag & dropping links to new...
Read more >
Faster Page-Loads by Prefetching Links During Idle Time
Link Prefetching This lets the browser fetch the resource and store it in its cache. Link prefetching includes is used in : Web...
Read more >
US20170171238A1 - Enhanced browsing with security scanning ...
The method scans the prefetched content from the second web page for a security threat, within the safe cache, wherein the safe cache...
Read more >
Diff - 8e638dc335900c2e886dc4ee9c2c28c010ab8f4d^^2 ...
Drawable); method public boolean willNotCacheDrawing(); method public boolean willNotDraw(); + field ... @param prefetchFlags flags to guide prefetching.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found