Hydration attribute mismatch after update Nuxt to v3.9.0
Environment
- Operating System: Linux
- Node Version: v18.18.0
- Nuxt Version: 3.9.0
- CLI Version: 3.10.0
- Nitro Version: 2.8.1
- Package Manager: [email protected]
- Builder: -
- User Config: devtools, modules, ui
- Runtime Modules: @nuxt/[email protected]
- Build Modules: -
Version
v2.11.1
Reproduction
https://stackblitz.com/edit/nuxt-starter-5tmfpt?file=components%2FUserForm.vue
Description
Hi guys,
I updated Nuxt to version 3.9.0 and I am getting Hydration attribute mismatch for example on USelectMenu or UDropdown viz screenshot. I think it is a bug and it is now showing after improve ssr hydration mismatch checks in Vue 3.4.
Additional context
No response
Logs
No response
I do have the same issue
I have the same issue
Also occurring with UCheckbox, here's a minimal reproduction (app.vue):
<template>
<UCheckbox v-model="state" label="Test checkbox" />
</template>
<script setup lang="ts">
const state = ref(true)
</script>
Notably does not occur when the ref is false.
Testing against 2.11.1 and 7151b7b97d42f389506521044ebaffa8a299e7fb with [email protected] both yield the same result.
getting same things now after the update
I also got plenty of hydration mismatch after upgrade.
same bug but without info after upgrade to 3.9.0 I tried with --no-force and --force and i have the same issue
Same here with ui-pro/landing template
I think this is due to latest vue 3.4, we have to override all of Headless UI generated ids with the future useId composable from Nuxt: https://github.com/nuxt/nuxt/pull/23368 but it hasn't been released yet.
In the meantime, can you try to set the resolution to vue to 3.3.13?
I think this is due to latest vue
3.4, we have to override all of Headless UI generated ids with the futureuseIdcomposable from Nuxt: nuxt/nuxt#23368 but it hasn't been released yet.In the meantime, can you try to set the resolution to
vueto3.3.13?
3.3.13 fixed it for me for now, thanks!
Nuxt3.9.1 still has this problem and 3.3.13 can solve it
Sorry for anoob question, but how did you achieved to pin [email protected]?
My package.json looks like below
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxt/ui": "^2.11.0",
"@nuxtjs/google-fonts": "^3.1.0",
"@pinia/nuxt": "^0.5.1",
"consola": "^3.2.3",
"nuxt-proxy": "^0.4.1",
"pinia": "^2.1.7",
"sass": "^1.69.5",
"vue": "^3.3.9",
"zod": "^3.22.4"
},
"devDependencies": {
"@iconify/vue": "^4.1.1",
"@nuxt/devtools": "^1.0.3",
"@nuxtjs/i18n": "^8.0.0-rc.5",
"@vueuse/core": "^10.6.1",
"@vueuse/nuxt": "^10.6.1",
"nuxt": "^3.9.0",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.7"
}
}
You need to set it in resolutions:
{
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxt/ui": "^2.11.0",
"@nuxtjs/google-fonts": "^3.1.0",
"@pinia/nuxt": "^0.5.1",
"consola": "^3.2.3",
"nuxt-proxy": "^0.4.1",
"pinia": "^2.1.7",
"sass": "^1.69.5",
"vue": "^3.3.9",
"zod": "^3.22.4"
},
"devDependencies": {
"@iconify/vue": "^4.1.1",
"@nuxt/devtools": "^1.0.3",
"@nuxtjs/i18n": "^8.0.0-rc.5",
"@vueuse/core": "^10.6.1",
"@vueuse/nuxt": "^10.6.1",
"nuxt": "^3.9.0",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.7"
},
"resolutions": {
"vue": "3.3.13"
}
}
@benjamincanac Thank you for quick reply. I've tried what you suggested and while executing npm list vue is shows as [email protected] deduped everywhere and app itself still throws hydration mismatch.
npm package.json docs doesnt mention usage of keyword resolutions. Should I use this package https://www.npmjs.com/package/npm-force-resolutions ?
Oh sorry, this is for yarn and pnpm. It seems you can use overrides with npm since 8.3.0.
i have the same issue with UTable - hydration mistmaches - warning on UCheckbox inside table component really dont want to downgrade versions(( any info when we can get update?
This seems related as well. See the following reproduction:
https://stackblitz.com/edit/nuxt-starter-t3xebe?file=components%2FAttributeTest.vue
I have a form with a dynamic action attribute. I even understand the hydration attr mismatch but why is the value wrong on initial load. It should have loaded with "something" and then changed to the clientside date/time. It can change based on the button click. This was unexpected for us.
I'm facing the same issue
i do have the same issue -\^-^/-
Ditto here.. causing all sorts of mismatches with a whole bunch of deps (headless, radix, etc etc). Think the best fix is upstream in vue?
I'm using Bun, which supports both the overrides and resolutions syntax. So the temporary solution for me is in package.json:
"overrides": {
"vue": "3.3.13"
},
Nuxt3.9.1仍然有这个问题,3.3.13可以解决
所以是要降低版本来解决这个问题吗