Sheezy-Art / sheezy-hub

Public repo to discuss issues and feature requests
https://sheezy.art/
14 stars 0 forks source link

[BUG] Hydration errors cause dark theme to get un-applied #388

Open knuxify opened 7 months ago

knuxify commented 7 months ago

Describe the Bug If the hydration fails (I managed to get it to happen by adding usercss with Stylus, it causes Sheezy to print messages like https://react.dev/errors/418?invariant=418 in the console, see attached video), the dark theme gets unapplied, even though it briefly shows up while loading the page.

(Not sure if this is a valid bug, since it's pretty unlikely to happen without tampering, but figured I'd report it anyways.)

To Reproduce Steps to reproduce the behavior:

  1. Do something to cause the site to fall back to client-side rendering; in my case, adding custom styling with Stylus seemed to cause it
  2. Load any page
  3. The dark theme loads for a split second, then switches back to the light theme

Expected Behaviour Client-side rendering can switch into dark mode the same way it does for hydration...? (tbh, I don't have much web dev experience, not sure if my interpretation is correct...)

Screenshots Screencast from 2024-02-05 19-40-45.webm

Device

OniriCorpe commented 4 months ago

i'm experiencing this bug using darkreader on firefox (windows) and noir on safari (iOS/iPadOS)

these two programs try to detect whether a web page is in dark mode or not, and if not, force a dark mode

they are triggering this bug and I'm forced to force a dark mode without detection so as not to have a light mode, otherwise detection fails and pages are displayed in light mode