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

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

Merged
merged 13 commits into from
Aug 23, 2022

Conversation

danielroe
Copy link
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

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

@danielroe danielroe requested a review from pi0 August 23, 2022 12:34
Copy link
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.

None yet

2 participants