Wrong theme icon displayed in production
Closed this issue · 2 comments
In a development environment things run as we expect them to, but in production environment when you visit the website in dark mode the DarkModeOff icon is displayed.
Nice catch!
No idea why this happens tho 🤔
Using React Dev tools, the hook values seem normal.
In fact, they are exactly the same as in development...
I've noticed that the Virtual DOM seems okay, because when you toggle the theme for the first time, the actual component changes (while the DOM does not, since it had the incorrect icon).
For some reason I haven't figured out, the Virtual DOM is not matching with the actual DOM 😢
Exactly!
Some surface level debugging also left me perplexed. The value of 'darkMode' (the variable based on which we show one icon or the other) is correct at all times both in production and development, i.e., there is no reason for this to happen.
I'll look into it in more detail when I find time.