Skip to content

Hydration node mismatch when using layouts #17011

Answered by danielroe
gaisinskii asked this question in Questions
Discussion options

You must be logged in to vote

This is a common SSR gotcha. The issue is that on SSR, Vue renders the HTML from top to bottom, outside to inside. And if you only fetch some data as you are rendering the 'inner' part of the page, it doesn't rerender the layout at the top of the page. (On client-side it's fine as can be reactive.) So if you have a common piece you rely on for rendering your page, make sure to fetch it in the layout, a plugin, or a middleware - somewhere outside of the rendering process.

https://github.com/nuxt/framework/issues/5669#issuecomment-1173538894

Replies: 0 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@gaisinskii
Comment options

@danielroe
Comment options

@gaisinskii
Comment options

@danielroe
Comment options

Answer selected by danielroe
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
Labels
3 participants