NuxtN
Nuxt15mo ago
Danny Vogel

Issue: Initial page load flash before hydration

Hi all, really hoping for some help here because I'm out of my mind. I can provide more context if needed.

I have a Nuxt 3 app that uses SSR. Everything was going pretty well until one day, seemingly at random, when you first visit the site, the app gets loaded and served but right before hydration, the page goes blank and reappears. This also happens when first accessing routes where SSR is false directly.

There are no errors, no hydration mismatch warnings. This happens all the time on our deployed app, and only occasionally when working on localhost. It happens right before onNuxtReady is called.

Since our app is deployed on cloud run, I was able to go back and find a build where this issue didn't exist, which helped me isolate the github commits where it started. I reverted/disabled everything I could think of and the issue didn't resolve. Ultimately, I just reverted back to the last build where the issue didn't exist and recovered the posterior commits one by one manually. And it worked, the deployed app was no longer flashing. Until a couple days and a couple commits later where the flash returned. These latest commits were insignificant and for parts that do not run on initial page load (removing an unused util, minor refactor of a tiny part).
image.png
Was this page helpful?