-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
feat: Add eagerness
support for prefetch()
#13405
Conversation
🦋 Changeset detectedLatest commit: 01ee0d0 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #13405 will not alter performanceComparing Summary
|
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 for your contribution @Marocco2. This is a new feature, so it requires some updates in our docs. Can you do that? Let us know if you have time, we plan a release next week
Co-authored-by: Emanuele Stoppa <[email protected]>
Thanks for replying! I'll check in these days what to do. Do you have any pipelines on how to add docs? |
Docs PR should be sent to |
Added docs here: withastro/docs#11250 |
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 PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
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 for contributing this feature! I'm sure people will appreciate this new option!
Here's my suggestion for an updated changeset based on the final docs. (Note that it doesn't have to be identical to docs, or explain the whole feature in detail -- usually it focuses more on the benefits, and gives people enough information to know whether they are interested in learning more).
Take from it what you like!
Co-authored-by: Sarah Rainsberger <[email protected]>
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.
Approving for docs, assuming nothing changes in the feature! (Docs PR is all approved and ready to go, too.) 🚀
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 @Marocco2
Changes
New
PrefetchOptions
parameagerness
that can be explicitly stated forprefetch()
function.Usecase: letting a browser manage when a page should be prerendered will simplify web site code compared to default behavior (no
eagerness
passed will automatically default toimmediate
, causing headcaches if you want to use FIFO strategy available formoderate
andconservative
args)Reference doc: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/speculationrules#eagerness
Testing
No tests added, as there weren't for
PrefetchOptions
Docs
/cc @withastro/maintainers-docs
prefetch()
doc should be updated accordingly to notify users a new option to be passed on