vuetify: [Bug Report][3.4.9] Hydration style mismatch VNavigationDrawer and VAppBar together

Environment

Vuetify Version: 3.4.9 Vue Version: 3.4.7 Browsers: Chrome 117.0.0.0 OS: Linux x86_64

Steps to reproduce

1.- Follow instructions exactly from https://vuetifyjs.com/en/getting-started/installation/#using-nuxt-3 2.- Add ssr on plugin createVuetify({ ssr: true }) 3.- Add minimal code on app.vue with VNavigationDrawer and VAppBar together

<template>
  <v-layout>
    <v-navigation-drawer />
    <v-app-bar />
    <v-main />
  </v-layout>
</template>

Expected Behavior

There should be no vue warns

Actual Behavior

There are mismatch vue warns

[Vue warn]: Hydration style mismatch on <header class=​"v-toolbar v-toolbar–density-default v-theme–light v-locale–is-ltr v-app-bar" style=​"top:​ 0px;​ z-index:​ 1004;​ transform:​ translateY(0%)​;​ position:​ fixed;​ left:​ 0px;​ width:​ calc((100% - 0px)​ - 0px)​;​">​…​​flex

rendered on server: style=“[object Map]” expected on client: style=“[object Map]”

Reproduction Link

https://stackblitz.com/edit/nuxt-starter-wtdujy

Other comments

Only occur using VNavigationDrawer and VAppBar together

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 20
  • Comments: 28 (4 by maintainers)

Commits related to this issue

Most upvoted comments

If you followed the Nuxt 3 Installation guide, and came here… Don’t forget to add ssr: true in createVuetify().

I am also seeing this on v-tabs where the selected tab is missing the selected classes on the server side.

I am also facing on v-tabs sharply now! Then i just use <client-only> </client-only> and hydration issue solve for v-tabs.

For example,

<client-only>
    <v-tabs v-model="tab" align-tabs="center" :key="tab">
      <v-tab
        v-for="(tabObj, index) in props?.blockItem?.value?.tabs"
        :key="tabObj.title + '_' + index"
        :value="index"
        base-color="primary-text"
        ><span>{{ tabObj.title }}</span></v-tab
      >
    </v-tabs>
    <v-tabs-window v-model="tab" class="mt-5">
      <v-tabs-window-item
        v-for="(tabObj, index) in props?.blockItem?.value?.tabs"
        :key="tabObj + '_container_' + index"
      >
        <MySlider :itemList="tabObj?.items" />
      </v-tabs-window-item>
    </v-tabs-window>
  </client-only>

I am also seeing this on v-tabs where the selected tab is missing the selected classes on the server side.

I’m also facing the same.

https://github.com/vuejs/core/issues/5300 doesn’t actually seem to be fixed

Still seeing this in v3.6.6, too.

Clearly an issue with SSR ids and client rendered ids that are used in classnames (they mismatch when the app is mounted).

yeah, all the issues related to this i’m seeing amount to this. the worst offender I think are v-tooltips - in my project, the SSR issue gave them all the same ID, leading to not only loads of warnings but also all of them displaying the same tooltip 😄

For now, wrapping them in a v-no-ssr is a workaround for that last issue, but obviously still throws a hydration mismatch warning.

Sorry to be the bearer of bad news, but could we reopen this issue? It is still reproduceable on the latest version of vuetify@3.5.11

https://stackblitz.com/edit/nuxt-starter-dsdqtb?file=package.json

This might be one of those issues that needs a global search and replace, seeing it in v-img too, v-navigation-drawer, and more components…

v-img

  • rendered on server: draggable=“true”
  • expected on client: draggable=“”

v-nav-d

  • rendered on server: class=“v-navigation-drawer v-navigation-drawer–left v-theme–darkTheme navigation-instances”
  • expected on client: class=“v-navigation-drawer v-navigation-drawer–left v-navigation-drawer–active v-theme–darkTheme navigation-instances”

v-toolbar

  • rendered on server: style=“top:0;z-index:1006;transform:translateY(0%);position:fixed;transition:none !important;”
  • expected on client: style=“top:0;z-index:1004;transform:translateY(0%);position:fixed;transition:none !important;”

Not sure if this helps? PS I’m on 3.4.10 vue/vuetify

Why is this marked as “Closed”? What is the solution for this problem?

I still have exact the same issue with v-app-bar with the mismatch Z-Index. My setup:

  • Nuxt: 3.16.0
  • Vue: 3.5.13
  • Vuetify: 3.7.18

Nuxt 3.4.12 / Vuetify 3.6.13 / Vue 3.4.34 and my v-navigation-drawer only works without throwing this warning if I wrap it in ClientOnly.

FYI, vuejs/core#5300 is marked as closed and issue is still present with:

Vue 3.4.19 Nuxt 3.10.2 Vuetify 3.5.4

Still happening in 3.5.13 with any app component like VAppBar:

[Vue warn]: Hydration style mismatch on <header class=​"v-toolbar v-toolbar--flat v-toolbar--density-default bg-transparent v-theme--dark v-locale--is-ltr v-app-bar position-fixed d-print-none" style=​"top:​ 0px;​ z-index:​ 906;​ transform:​ translateY(0%)​;​ position:​ absolute;​ left:​ 0px;​ width:​ calc(100% + 0px)​;​">​…​</header>​flex 
  - rendered on server: style="top:0;z-index:906;transform:translateY(0%);position:absolute;transition:none !important;"
  - expected on client: style="top:0;z-index:904;transform:translateY(0%);position:absolute;transition:none !important;"
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.```

Same over here with vuetify@3.5.11:

[Vue warn]: Hydration style mismatch on 
<header id="nav-main" class="v-toolbar v-toolbar--fla… v-app-bar text-primary" style="top:0;z-index:1006;trans…sition:none !important;" app="" data-v-a254f246=""> 
  - rendered on server: style="top:0;z-index:1006;transform:translateY(0%);position:fixed;transition:none !important;"
  - expected on client: style="top:0;z-index:1004;transform:translateY(0%);position:fixed;transition:none !important;"