Closed longnguyen2004 closed 1 year ago
Hi! Thank you for this contribution! I'll not immediately merge since I want to analyze the issue again, since I'm not 100% sure what the cause yet.
Sorry, been busy with work, will check this out this week!
I can't seem to replicate the issue that this PR seems to fix. Can you?
Here's a StackBlitz repro of the issue https://stackblitz.com/edit/svelteui-dark-mode-bug-repro And here's a video describing the bug
https://github.com/svelteuidev/svelteui/assets/15729831/4a68e257-de3f-4328-857f-0dc390663d5c
Basically, if the initial theme state is dark, then some components will be stuck in the dark state, because currentTheme
is not reactive, so the dark-theme
class is stuck on in the wrapper div.
There's also the issue of the background being initially white, before switching to dark, which is due to this not being SSR friendly. I didn't include a fix for that here, but I've outlined potential fixes for it in https://github.com/svelteuidev/svelteui/issues/334#issuecomment-1510995639
After merging this I'll make a new release, and fixing this for good will be the focus of the next one, I think
While you're at it, have a look at #373 and #370 too, those are trivial fixes
While you're at it, have a look at #373 and #370 too, those are trivial fixes
Yap, looking at them now. I'll see if I can fix them and make a release this afternoon
Description
Making
currentTheme
reactive, so the wrapperdiv
class syncs up with thehtml
class. Partially fixes #334Before submitting the PR, please make sure you do the following
[@svelteui/core]
,[@svelteui/actions]
,[@svelteui/motion]
,[@svelteui/core]
,[core]
, or[docs]
.yarn lint
andyarn test
or just runyarn prepush
.