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

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.

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

Copy link
Copy Markdown

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

Comment threadpackages/nuxt/src/app/components/nuxt-link.ts Outdated
Comment threadpackages/vite/src/client.ts Outdated
pi0
pi0 approved these changes Dec 2, 2022
@danielroe
danielroe merged commit 52421a9 into mainDec 2, 2022
@danielroe
danielroe deleted the fix/defer-prefetching branch December 2, 2022 16:13
@pi0pi0 mentioned this pull request Dec 15, 2022
6 tasks
@danielroedanielroe mentioned this pull request Jan 20, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@danielroe@pi0