Open
Description
Vue version
3.5.13
Link to minimal reproduction
https://stackblitz.com/edit/vue-ssr-example-bsqzmafk?file=app.js,client.js,server.js
Steps to reproduce
open your console and see there's a hydration mismatch.
Comp.vue
's useId is not retturning the same value server side and client side
What is expected?
no hydration issue due to useId
What is actually happening?
The cause of this issue is that we run onServerPrefetch
only server-side.
This happen in Nuxt because we treeshake onServerPrefetch
in client-bundle and we also wrap onServerPrefetch
with import.meta.server
flag in useAsyncData
composable.
In runtime, this results into the component being marked as async boudary only server side with markAsyncBoundary
but not client side --> resulting to a hydration issue because useId
returns different strings.
System Info
No response
Any additional comments?
Nuxt issue nuxt/nuxt#30289