Client-server mismatch when the color mode is set to system
#5227
Labels
💻 aspect: code
Concerns the software code in the repository
🛠 goal: fix
Bug fix
🟧 priority: high
Stalls work on the project or its dependents
🧱 stack: frontend
Related to the Nuxt frontend
Description
When the color mode is set to default
system
, and the user's preference is dark, there is a client-server mismatch which probably causes the page to re-render.The problem is with the use of
usePreferredColorScheme
inosColorMode
: on the server, the media query is not available, so the value is set to defaultno-preference
, setting the effective color mode to "light". If the user's system is set todark
, the media query returns "dark" on the client. Normally, this would not cause a mismatch since only the rendering of the CSS values would change, but we use different icons (for the theme switcher - sun/moon, and for the licenses) in different color modes, so this causes client-server mismatch.Reproduction
Screenshots
Additional context
The text was updated successfully, but these errors were encountered: