Implement Speculation Rules API in prefetch #794
rossrobino
started this conversation in
Proposal
Replies: 1 comment 4 replies
-
|
I'm open to supporting this in Adding as a new experimental option is a good start for me, feel free to contribute a PR if you like. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Chrome currently has the speculation rules API enabled without a flag. This api allows you to pre-render multipage applications/html on the client, even running the script tags on the page. This helps for a faster experience and to reduce layout shift. It'd be great if Astro prefetch had an experimental option to enable this progressive enhancement.
Here's a prefetch function I've wrote to do this, when it's supported.
https://github.com/rossrobino/domco/blob/ee9ab7926a22f4e88d2971e3061801a5056105b7/packages/domco/helpers/prefetch/index.ts#L71
I really enjoy using Astro, thanks for your consideration!
Beta Was this translation helpful? Give feedback.
All reactions