添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Client-side Hydration Error

What is Vue.js app Failed to execute 'appendChild' on 'Node' error? When working on your Vue or Nuxt project, sometimes you may face the following Js error in your console and the page becomes unresponsive: The client-side rendered virtual DOM tree is not matching server-rendered content.

But what is Hydration ?

In Vue, Hydration is the mechanism by which the client-side converts the static HTML fetched from server to the reactive code. In other words, when we open up a link, in the first request we get all the rendered HTML from server (natural behavior in SSR). This rendered HTML is the human-readable content that is not yet an interactive app. So, to add the reactivity and to control our clien-side app we need to have the same Vue application that was run on the server. This way it attaches DOM event listeners and makes the front app reactive. So, in the context of our problem (above mentioned console error), we expect to see it once the content gets loaded. If you want to read more about the Hydration process you can also check this article . It seems that there is not a complete tool to prevent the Hydration issues, but it's not a big issue. Chrome browser can help us to do that in some way. In your development environment, try to navigate and refresh the pages that you know the problem comes from. Open up your console and you can see that it shows where the virtual DOM does not match the SSR HTML. By using Qwik technology you can load pages even faster by diminishing hydration process with Resumable . Qwik initial version released on May 2, 2023. Read more here .
Headless Commerce: Do I need Headless Commerce? 2024
2 Key Reasons to Consider Headless Commerce Authored by: Sam Berry
Which eCommerce Platform? 2024 Why it's not Shopify!
WooCommerce, PrestaShop or Magento? Which platform should I use in 2024? Authored by: Sam Berry