Skip to content

Hydrating whole pages #14

Answered by ElMassimo
gustojs asked this question in Q&A
Discussion options

You must be logged in to vote

@gustojs Because page components have access to the entire context (page, frontmatter, meta), allowing to hydrate them could potentially bloat the bundle, as that all that data would need to be included.

Also, the amount of JS needed to hydrate the page would negate the benefit of using islands.

I would recommend abstracting functionality in larger pieces, such as a <ShoppingCart>, or <UserAvatar/>.


An article that I will add to the docs soon talks about some limitations when using islands:

  • Don't use usePage and useRoute, neither data nor vue-router will be available in the bundle
  • Pass everything the component needs explicitly as props

Vitepress has a built-in optimization that provid…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ElMassimo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants