Dark mode class goes away...

The dark class on <html class="" goes away between page navigation. When the page is initially loaded it exists but when I (or anyone else) navigate to another page this class is removed. Anyone else experience this? Ref issue: https://github.com/alexjustesen/speedtest-tracker/issues/2029
GitHub
Keeps reverting to light mode since 1.2.1 · Issue #2029 · alexjuste...
Describe the bug Since updating to 1.2.1, any section I click on the left side navbar results in a switch to light mode, singeing my retinas. The initial dashboard page loads in dark theme but any ...
Solution:
I think I got it, livewire update was the cuplrit. v3.5.19 the bug exists, downgraded to v3.5.18 and it works as expected
Jump to solution
11 Replies
awcodes
awcodes4w ago
Sounds like something is blocking / slowing down the js on the pages. That attribute is handled by alpine.
JDMhammer
JDMhammerOP4w ago
I had thought something might be related to JS so I checked the console and no errors are thrown... Any debugging suggestions for somewhere else to look?
awcodes
awcodes4w ago
Check the waterfall in dev tools to see if there’s any other blocking js. It wouldn’t throw an error, but can delay execution time on the main thread. My guess is a third party script that is initializing slowly for some reason.
JDMhammer
JDMhammerOP4w ago
Nothing stands out, I can see the livewire update, the fetch for the next page and then the avatar being loaded.
awcodes
awcodes4w ago
Hmm. That’s the only thing that comes to mind. Sorry. Haven’t actually experienced the issue. Unless they somehow have cache disabled in their browser and a slow connection I just don’t see how it would be a problem. I don’t think it’s filament bug though. Since filament is doing the same thing as most other sites for handling light/dark mode with tailwind. Have you been able to reproduce it locally?
JDMhammer
JDMhammerOP4w ago
Which is what's throwing me for a loop too, I'm able to reproduce it locally with both Chrome, Edge and FF. If I disable spa() because it's a full load its fine.
awcodes
awcodes4w ago
Ah. Didn’t know spa was being used. But that still doesn’t make sense because alpine knows the state since it’s in alpine’s storage. That makes me wonder if it’s a deeper level bug. There’s still a lot of issues with spa mode in livewire. Could be something there.
Solution
JDMhammer
JDMhammer4w ago
I think I got it, livewire update was the cuplrit. v3.5.19 the bug exists, downgraded to v3.5.18 and it works as expected
awcodes
awcodes4w ago
Not 💯 sure though. Hmm. Yea, there was some issues with LW where we had to lock down the version in filament, but iirc those have since been fixed and resolved.
awcodes
awcodes4w ago
Actually, it looks like filament is currently locked down to livewire 3.5.12. https://github.com/filamentphp/filament/blob/3.x/packages/support/composer.json
GitHub
filament/packages/support/composer.json at 3.x · filamentphp/filament
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
JDMhammer
JDMhammerOP4w ago
I just noticed that too, I'm going to remove my dep reference and roll with the Filament specified version

Did you find this page helpful?