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

Continue prefetching as the user scrolls #6

Closed
jadjoubran opened this issue Dec 5, 2018 · 4 comments
Closed

Continue prefetching as the user scrolls #6

jadjoubran opened this issue Dec 5, 2018 · 4 comments

Comments

@jadjoubran
Copy link
Collaborator

jadjoubran commented Dec 5, 2018

Does it make sense to prefetch links as the user is scrolling?

Here's a screencast of an example where I'm reading a JavaScript usecase and when I scroll towards the end, it would be nice for quicklink to prefetch those 2 related usecases
Screencast link: https://photos.app.goo.gl/mHgwbTmoKYXmXudEA

@addyosmani
Copy link
Collaborator

Thanks for the suggestion. I have this working in a local branch now:

image

The one thing I need to play around with is whether we'll need to add a level of debouncing + usage of Intersection Observer thresholds to limit how often we're firing refiring prefetching.

The internal prefetch.mjs maintains its own in-memory log of what was previously fetched so its less a concern of making repeated network requests for URLs and more just avoiding overhead (though I haven't yet had a chance to measure this properly).

I'll clean this up and get it pushed to the repo soon.

@addyosmani
Copy link
Collaborator

@jadjoubran Do you have a preference on whether this behavior is the default vs an option?

@jadjoubran
Copy link
Collaborator Author

oh looks great!

@jadjoubran Do you have a preference on whether this behavior is the default vs an option?

Good point, maybe enable it by default but allow an option to disable it. Maybe it makes sense to disable it for websites where most of the navigation happens above the fold

@addyosmani
Copy link
Collaborator

After thinking about this a little further, I think it's fair game to prefetch in-viewport links as the user scrolls. We an address an option for controlling this if folks ask for it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants