next-themes icon indicating copy to clipboard operation
next-themes copied to clipboard

Next Themes Flash of White BG when using the basePath

Open MaedahBatool opened this issue 1 year ago • 4 comments

Hi folks, thanks for all the awesome work here.

I'm using the latest next-themes and next but getting a flash of white bg when loading the page for the first time only.

On the homepage there's no flash, but I'm using basePath: '/docs' if I go to localhost:3000/docs or even online in the live prod site, I see an issue only on the basePath URL — https://sourcegraph.com/docs — which makes me wonder if the basePath causes this issue. I have tried building and serving locally, same issue. Only happens on the basePath /docs and doesn't happen on localhost:300/

Help!

MaedahBatool avatar Dec 14 '23 00:12 MaedahBatool

For some reason, the dark class on HTML is being removed and added again during page load. You can notice this more easily if you throttle the load through the Network Tab. Probably implementation issue

PixeledCode avatar Dec 16 '23 10:12 PixeledCode

@PixeledCode I'm seeing the same weird behavior 😕

jahirfiquitiva avatar Jan 19 '24 14:01 jahirfiquitiva

as am I

JackNapolitano avatar Jan 24 '24 20:01 JackNapolitano

@MaedahBatool Did you manage to solve this issue? Page routing is not used anywhere in next-themes, so I doubt that it has anything to do with the setting. I would assume that the issue is that the loading of the script somehow is deferd.

trm217 avatar Apr 23 '24 08:04 trm217