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

Update prefetch docs with browser support information #8246

Merged
merged 6 commits into from
May 15, 2024

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented May 10, 2024

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)

@bluwy bluwy added the add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. label May 10, 2024
Copy link

vercel bot commented May 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 15, 2024 3:15pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs-i18n ⬜️ Ignored (Inspect) May 15, 2024 3:15pm

@@ -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.
Copy link
Member Author

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.

Comment on lines -109 to -118
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' });
```
Copy link
Member Author

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.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented May 10, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en guides/prefetch.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

Copy link
Member

@sarah11918 sarah11918 left a 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!

src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
src/content/docs/en/guides/prefetch.mdx Outdated Show resolved Hide resolved
@sarah11918 sarah11918 added the merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) label May 14, 2024
Co-authored-by: Sarah Rainsberger <[email protected]>
@bluwy
Copy link
Member Author

bluwy commented May 14, 2024

Thanks! I like your suggested formatting too. I committed them and view locally and it looks like this:

Screenshot (Vercel link should also be possible) image

Seeing this, maybe we could remove the Support: prefix on each paragraphs? Since the heading "Browser support" already implies so.

@sarah11918
Copy link
Member

sarah11918 commented May 14, 2024

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 "fetch() API which"

@bluwy
Copy link
Member Author

bluwy commented May 15, 2024

Thanks! I've updated and removed them now.

@bluwy
Copy link
Member Author

bluwy commented May 15, 2024

@sarah11918 the core PR has been released. Waiting on your approval just in case and I think we can then merge this

@sarah11918
Copy link
Member

@bluwy Thanks, taking one more final pass now, then I'll merge!

Copy link
Member

@sarah11918 sarah11918 left a 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!

@sarah11918 sarah11918 added the Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! label May 15, 2024
@sarah11918 sarah11918 merged commit 30a4314 into main May 15, 2024
7 of 8 checks passed
@sarah11918 sarah11918 deleted the prefetch-docs-update branch May 15, 2024 15:15
thomasbnt added a commit to thomasbnt/docs that referenced this pull request Jun 25, 2024
yanthomasdev added a commit that referenced this pull request Jun 25, 2024
* i18n(fr): Update guides/astro-db from #8478

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/backend from #8450

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/backend/google-firebase from #8422

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/cms/apostrophecms from #8480

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/cms/builderio from #8259

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/cms/directus from #8647

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/cms/ghost from #8518

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/cms/statamic from #7119

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/content-collections from #8447

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/data-fetching from #8210

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/deploy/cloudflare from #8421

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/deploy/netlify from #8233

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/deploy/render from #8233

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/deploy/vercel from #8217 (and fix little typos)

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/environment-variables from #8533

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/environment-variables from #8611

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/images from #8447 #8646

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide from #8575

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide/cloudflare from #8211

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide/lit from #8270

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide/markdoc from #8167 (Steeeeps)

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide/preact from #8644

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide/react from #8038

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/integrations-guide/vue from #8295

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/markdown-content from #7218

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/markdown-content from #8167 #8239

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/middleware from #8572

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/prefetch from #8246

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/routing from #8466

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/rss from #8632

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/testing from #8369

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update guides/view-transitions from #8646

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Fix typo in routing.mdx

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Fix links ?

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Fix badge

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Fix badge

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Fix tabs

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Fix tabs

Signed-off-by: Thomas Bonnet <[email protected]>

* Update src/content/docs/fr/guides/environment-variables.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/integrations-guide/lit.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/integrations-guide/vue.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/markdown-content.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/middleware.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/testing.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/testing.mdx

Co-authored-by: pioupia <[email protected]>

* Update src/content/docs/fr/guides/testing.mdx

Co-authored-by: pioupia <[email protected]>

* i18n(fr): Fix links

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): Update `tutorial/6-islands` because CI links err

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): fix links

Signed-off-by: Thomas Bonnet <[email protected]>

* i18n(fr): fix links

Signed-off-by: Thomas Bonnet <[email protected]>

---------

Signed-off-by: Thomas Bonnet <[email protected]>
Co-authored-by: pioupia <[email protected]>
Co-authored-by: Yan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants