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

fix(nuxt): defer render-blocking prefetches until after load - #9475

Merged
danielroe merged 4 commits into
mainfrom
fix/defer-prefetching
Dec 2, 2022
Merged

fix(nuxt): defer render-blocking prefetches until after load#9475
danielroe merged 4 commits into
mainfrom
fix/defer-prefetching

Conversation

@danielroe

Copy link
Copy Markdown
Member

❓ 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

Two related performance bugs:

  1. When loading a page with links, these pages are prefetched immediately, which will delay the DOM Content Loaded event. This PR defers initialising observer until component is mounted, and additionally waits until the entire app is hydrated.

  2. If we are rendering a page with inlined styles, vite will immediately inject a preload for the very same CSS chunk that is inlined; we can use control of the chunk preloader to skip loading those chunks.

📝 Checklist

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

@danielroe danielroe added the bug Something isn't working label Dec 2, 2022
@danielroe
danielroe requested a review from pi0 December 2, 2022 13:33
@danielroe danielroe self-assigned this Dec 2, 2022
@codesandbox

codesandbox Bot commented Dec 2, 2022

Copy link
Copy Markdown

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

Comment thread packages/nuxt/src/app/components/nuxt-link.ts Outdated
Comment thread packages/vite/src/client.ts Outdated
@danielroe
danielroe merged commit 52421a9 into main Dec 2, 2022
@danielroe
danielroe deleted the fix/defer-prefetching branch December 2, 2022 16:13
@pi0 pi0 mentioned this pull request Dec 15, 2022
6 tasks
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe mentioned this pull request Jan 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.x bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants