-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useHead causes flickering when hydrating SSR-rendered page on Nuxt #75
Comments
@antfu Hey Anthony, any ideas on why this is happening and how to resolve it? Unfortunately nuxt/bridge#277 didn't address the issue. |
Here's a possibly dumb idea: What if we just debounced
Does This feels pretty hacky to me, so I'm sure there's a better way. |
Also running into the same issue using vueuse/head: 0.7.9 in nuxt: 3.0.0-rc.8. |
I was able to workaround this by calling |
This most definitely helps! I moved my offending |
The workaround doesn't work for me, unfortunately, since I don't have enough data in the middleware to actually populate the head. |
Temporary workaround using a debounce function seems to solve it: #78 (comment), will need to investigate if there's something more elegant |
Available in https://github.com/vueuse/head/releases/tag/v0.8.0, will be shipped to Nuxt in the next few days |
Original issue is nuxt/nuxt#14271
Environment
Linux
v16.14.0
3.0.0-rc.4
npm@8.3.1
vite
modules
,css
@nuxtjs/tailwindcss@5.1.3
-
Reproduction
Use
useHead
to assign some CSS classes to body, and then visit the page:useHead-flicker.mp4
Describe the bug
SSR correctly generates classes on body, then on hydration they are removed and then added again, resulting in a very noticeable flicker, especially when these classes are used to switch between dark and light styles of whole page.
The text was updated successfully, but these errors were encountered: