Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

perf(nuxt): improve link prefetching - #8225

Merged
pi0 merged 7 commits into
mainfrom
feat/prefetch-improvements
Oct 17, 2022
Merged

perf(nuxt): improve link prefetching#8225
pi0 merged 7 commits into
mainfrom
feat/prefetch-improvements

Conversation

@danielroe

Copy link
Copy Markdown
Member

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR bundles a number of improvements to the link prefetching feature of <NuxtLink>:

  1. It implements crossorigin prefetches using the Speculation Rules API - this is behind a flag for experimentation.
  2. It disables prefetching for links with target: _blank as there is no benefit to doing so.
  3. It throttles preload requests (as, the way we do it, these are high priority requests and could block other more urgent user interaction with the page). This implementation could likely be improved but I aimed to keep it lightweight.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing performance labels Oct 15, 2022
@danielroe
danielroe requested a review from pi0 October 15, 2022 21:38
@danielroe danielroe self-assigned this Oct 15, 2022
@codesandbox

codesandbox Bot commented Oct 15, 2022

Copy link
Copy Markdown

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@netlify

netlify Bot commented Oct 15, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs canceled.

Name Link
🔨 Latest commit 4154eee
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/634d10e58c5afc000815a382

Comment thread packages/nuxt/src/app/components/nuxt-link.ts Outdated
Comment thread packages/nuxt/src/app/plugins/cross-origin-prefetch.client.ts
Comment thread packages/nuxt/src/app/composables/preload.ts
@pi0
pi0 merged commit 2a4ebfb into main Oct 17, 2022
@pi0
pi0 deleted the feat/prefetch-improvements branch October 17, 2022 11:15
@pi0 pi0 mentioned this pull request Oct 18, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.x enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants