vuetify-nuxt-module icon indicating copy to clipboard operation
vuetify-nuxt-module copied to clipboard

hydration mismatch for z-index

Open bux opened this issue 1 year ago • 2 comments

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>

bux avatar Mar 18 '24 12:03 bux

+1

nsd0kleuschner avatar Apr 18 '24 10:04 nsd0kleuschner

+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.

BlueBazze avatar Apr 24 '24 11:04 BlueBazze

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.

userquin avatar Jul 20 '24 10:07 userquin