-
Notifications
You must be signed in to change notification settings - Fork 152
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
expose CSS variables to avoid FOUC during SSR #149
Comments
Closing as SSR is now supported |
@carbonrobot I looked at the PR and I'm not 100% sure this is solved. SSR has never been the problem. We use this package in Docusaurus to render things at build time. Client components are still SSRed, and can use client-side hooks, unlike RSCs. Removing client-side hooks only unlocks RSCs. SSR has always been supported, and the FOUC issue is probably still there. I don't see any alternative to using CSS env variables for styling tokens instead of using hardcoded colors. The only case I can see where this would be solved is when the dark/light mode is stored in a cookie and where the SSR server is able to read it. But the color scheme is more likely to be stored in localStorage in many apps, and when using SSG, there's no cookie available at all at build time. |
@slorber Thanks, you are correct I may have closed this one prematurely. I'm not sure a fix is possible for the dark/light mode FOUC. As you correctly pointed out we don't have that information available during SSR in order to know which mode to render. Any method to determine it would be dependent on the meta framework and any cache strategy used. I will try to revisit the linked PR approach and see if its still the path forward. |
Context:
Useful info:
The text was updated successfully, but these errors were encountered: