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

feat(nuxt): allow programmatically prefetching global components#6661

Merged
pi0 merged 13 commits intomainfrom
feat/global-component-prefetching
Aug 23, 2022
Merged

feat(nuxt): allow programmatically prefetching global components#6661
pi0 merged 13 commits intomainfrom
feat/global-component-prefetching

Conversation

@danielroe
Copy link
Copy Markdown
Member

@danielroe danielroe commented Aug 16, 2022

🔗 Linked issue

nuxt/nuxt#14584

❓ 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 adds a new hook (components:prefetch) that allows prefetching of global components (Pascal case required, to avoid runtime addition of scule utility). We could also expose a utility like nuxtApp.prefetch or standalone prefetchComponent that uses this hook under the hood.

This PR exposes new preloadComponents utility that allows prefetching of global components (Pascal case required, to avoid runtime addition of scule utility).

Also an alias prefetchComponents is exposed which does same as preloadComponents but as we progress to make better implementation based on manifest maps, users can already opt-in to use semantically write utility.

📝 Checklist

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

@danielroe danielroe added enhancement New feature or request components 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Aug 16, 2022
@danielroe danielroe requested a review from pi0 August 16, 2022 07:45
@danielroe danielroe self-assigned this Aug 16, 2022
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 16, 2022

Deploy Preview for nuxt3-docs canceled.

Name Link
🔨 Latest commit 530b070
🔍 Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/63051baa2637a90009d3e13b

Comment thread packages/nuxt/src/components/templates.ts Outdated
Comment thread packages/nuxt/src/app/composables/prefetch.ts Outdated
@danielroe danielroe requested a review from pi0 August 23, 2022 12:34
Copy link
Copy Markdown
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. As discussed with @danielroe we should iterate over this to make use of build manifest to generate actual <link> tags and also implement server-side rendering hints (currently not needed with #6876)

@pi0 pi0 merged commit f3499d7 into main Aug 23, 2022
@pi0 pi0 deleted the feat/global-component-prefetching branch August 23, 2022 19:12
@pi0 pi0 mentioned this pull request Aug 26, 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 components enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants