zankhq / astros

Template with astro, tailwind and alpinejs
https://astros.zank.studio
GNU General Public License v3.0
196 stars 66 forks source link

Fix theme flashing #40

Closed djmtype closed 9 months ago

djmtype commented 9 months ago

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?

zanhk commented 9 months ago

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

djmtype commented 9 months ago

@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.

zanhk commented 9 months ago

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

djmtype commented 9 months ago

@zanhk That seems to have fixed it!