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
Update prefetch docs with browser support information #8246
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
@@ -51,7 +51,6 @@ Each strategy is fine-tuned to only prefetch when needed and save your users' ba | |||
|
|||
- If a visitor is using [data saver mode](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/saveData) or has a [slow connection](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType), prefetch will fallback to the `tap` strategy. | |||
- Quickly hovering or scrolling over links will not prefetch them. | |||
- Links that use the `viewport` or `load` strategy are prefetched with a lower priority to avoid clogging up the network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will no longer be the case as all strategies will internally use <link rel="prefetch">
which has the same (low) priority.
You can additionally configure the priority of prefetching by passing the `with` option: | ||
|
||
```js | ||
// Prefetch with `fetch()`, which has a higher priority. | ||
prefetch('/about', { with: 'fetch' }); | ||
|
||
// Prefetch with `<link rel="prefetch">`, which has a lower priority | ||
// and manually scheduled by the browser. (default) | ||
prefetch('/about', { with: 'link' }); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The with
option is deprecated so I removed this to discourage people from using it.
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @bluwy !
I tried something different with the browser support section (haven't seen it in preview yet, so it might be awful). Let's see what we think!
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Yup, agreed! I had it in my head that maybe the different original list items were going to be different, repeatable "things"... but nope, I think without will be just fine! nit: just seeing now: in the Safari one, there's no comma between " |
Thanks! I've updated and removed them now. |
@sarah11918 the core PR has been released. Waiting on your approval just in case and I think we can then merge this |
@bluwy Thanks, taking one more final pass now, then I'll merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @bluwy , LGTM!
Description (required)
Update the prefetch docs based on the core PR linked below, which includes some internal behaviour changes.
I also added a new browser support section to explain the behaviour difference between browsers, and how to ensure prefetching works reliably.
Related issues & labels (optional)
For next Astro patch. See astro PR withastro/astro#10999 (not a minor)