vuetifyjs / nuxt-module

Zero-config Nuxt Module for Vuetify
https://nuxt.vuetifyjs.com/
MIT License
226 stars 22 forks source link

hydration mismatch for z-index #205

Closed bux closed 4 months ago

bux commented 8 months ago

I'm experiencing hydration mismatches. image

I'm using the following code:

<script setup lang="ts">
const drawer = defineModel<boolean>()
</script>

<template>
  <v-navigation-drawer v-model="drawer">
    <v-list>
      <v-list-item title="Navigation drawer" />
    </v-list>
  </v-navigation-drawer>
</template>

when setting the z-index to a fixed value the issue is gone:

<script setup lang="ts">
const drawer = defineModel<boolean>()
</script>

<template>
-  <v-navigation-drawer v-model="drawer">
+  <v-navigation-drawer v-model="drawer" style="z-index: 1005;">
    <v-list>
      <v-list-item title="Navigation drawer" />
    </v-list>
  </v-navigation-drawer>
</template>
nsd0kleuschner commented 7 months ago

+1

BlueBazze commented 7 months ago

+1

 - rendered on server: style="background-color:#ffb4a8;color:#000;caret-color:#000;left:0;z-index:1006;transform:translateX(0%);position:fixed;transition:none !important;"
 - expected on client: style="background-color:#ffb4a8;color:#000;caret-color:#000;left:0;z-index:1004;transform:translateX(0%);position:fixed;transition:none !important;"
  Note: this mismatch is check-only. The DOM will not be rectified in production due to performance overhead.
userquin commented 4 months ago

This should be fixed with latest Vuetify v3.6.14, wrapping the drawer with v-app or v-layout works.

If you disable ssr client hints, the layout suspense will show the drawer once useLayoutItem promise resolved, when using ssr client hints (only on desktop browser), the drawer will be displayed on page refresh (no slide transition).

Check this repo https://github.com/userquin/nuxt-vuetify-issue-205-v-issue-19015, you can switch ssr client hints then run npm run build && node .output/server/index.mjs, the hydration missmatch warning shouldn't be there.