rgerum / unofficial-duolingo-stories

This project brings the official Duolingo Stories to new languages, translated by a community effort.
https://duostories.org
135 stars 28 forks source link

Fix initialState useDarkLight in loggedinbutton.jsx #247

Closed PaoloDiBello closed 10 months ago

PaoloDiBello commented 10 months ago

Resolved the issue where the light mode button was incorrectly displayed upon hovering over the avatar in light mode. Adjusted the code to now show the dark mode button as expected when hovering over the avatar. This commit addresses the problem reported in issue #245.

PaoloDiBello commented 10 months ago

Sorry @rgerum, I think my last fix didn't properly address the problem, but I think this will do it. Initially, document.body.dataset.theme is undefined, so this condition typeof document !== "undefined" was not enough.

This might fix it:


-typeof document !== "undefined" ? document.body.dataset.theme : "light"
+document?.body?.dataset?.theme || "light",