kajirikajiri(wsl2)
gh-pages
gh-pages
  • Initial page
  • 🍳😋🎵
    • githubの新しい使い方
    • itunes miniplayer 前面固定(windows)
    • force darkmode chrome and disable white flash
    • wsl2 色 変更
    • quaker oats
    • 圧力鍋 ホイル焼き
  • 💪💪🏻💪🏼🦾💪🏽💪🏾💪🏿
    • gh-openの改造
    • GraphQL
  • gh-open not working with wsl2
  • react hook を5分で使う
  • 5分でLambda Storeをつかってみた
  • 実働環境で色々updateして得た知見 vue nuxt vuetify
  • dexie firebase nuxt vuetifyでオフラインpwaメモ帳作った
  • worker api batch
  • docker run syntax error
  • webpack babel
  • chainer?
  • nuxtjs firebase ui window is not defined
  • nuxt firebaseui ui broken
  • typescript 導入 実働 既存 環境
  • code-prettify nuxt
  • rustを動かしてみる
  • js 復習
  • vue The client-side rendered virtual DOM tree
  • ApexChartsがSSRで描画されない
  • atcoder
  • gitbook Page build failure
  • globalThis
  • Promise.allSettled
  • export * as ns from "module"
  • matchAll
  • js nullish
  • nullish optional chaining
  • nullish node 14 vs 13
  • nodenv global not working
GitBook提供
このページ内

役に立ちましたか?

vue The client-side rendered virtual DOM tree

前へjs 復習次へApexChartsがSSRで描画されない

最終更新 5 年前

役に立ちましたか?

まとめ
developでは動いたとしても、本番モードでは動かないかもしれない

先日vueを使っていたらエラーが発生した


 [Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content.
 This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>.
 Bailing hydration and performing full client-side render. 

調べてみると、serverside でレンダリングされたDOMとclientsideで生成されたDOMが一致しないためらしい。

develop環境では普通に動いていたので、warnだからまあ。。。と思って放置していた

そしたら、stagingで動かない。。。調べた結果

開発モードでは、Vueはクライアント側で生成された仮想DOMツリーがサーバーからレンダリングされたDOM構造と一致していることを保証します。一致しない場合は、ハイドレーションを中止し、既存の DOM を破棄してゼロからレンダリングします。本番モードでは、パフォーマンスを最大化するためにこのアサーションは無効になっています。

In development mode, Vue will assert the client-side generated virtual DOM tree matches the DOM structure rendered from the server. If there is a mismatch, it will bail hydration, discard existing DOM and render from scratch. In production mode, this assertion is disabled for maximum performance.

つまり、develop環境ではゼロからレンダリングをし直すが、stagingでは保証されていない。

なので、stagingで動かなかったという結論に至った

developでは動いていたのでびびった

Client Side Hydration | Vue SSR Guide