zankhq / astros

Template with astro, tailwind and alpinejs

Home Page:https://astros.zank.studio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix theme flashing

djmtype opened this issue · comments

Whenever the page gets reloaded, there is an undesirable flash of the light theme when the OS is set to dark. Would the Alpine persist plugin fix that?

Hi @djmtype you mean when doing a full refresh of the page (like with CTRL + F5)?

@zanhk My OS is set to dark mode. When visiting any page or pressing the browser's refresh button, the light theme always renders before the dark theme gets applied. Therefore, it creates a flash.

You can try it yourself by opening devtools, under the Network tab, enable Disable Cache, and change No throttling to Fast 3G.

@djmtype it should be fixed now, can you confirm?

@zanhk That seems to have fixed it!