Describe the bug
It looks like using setMode('system') somehow breaks mode-watcher.
I have a typical three-button mode control: Light, System, and Dark. Everything worked fine until 1.0 release. But now the behavior of mode-watcher is unstable if the mode is switched sequentially via setMode and system value was used. mode.current stops reflecting the actual mode. However, reloading the page will apply the proper mode that was set last.
Reproduction
Just click through Light/System/Dark sequentially in both directions.
Demo: https://sveltekit-mode-watcher.vercel.app/
Source: https://github.com/yellowby/sveltekit-mode-watcher/blob/main/src/routes/%2Bpage.svelte
Logs
System Info
System:
OS: Windows 11 10.0.26100
CPU: (32) x64 AMD Ryzen 9 9950X3D 16-Core Processor
Memory: 63.18 GB / 95.58 GB
Binaries:
Node: 22.16.0 - ~\AppData\Local\fnm_multishells\43252_1750065416485\node.EXE
npm: 10.9.2 - ~\AppData\Local\fnm_multishells\43252_1750065416485\npm.CMD
pnpm: 10.11.0 - ~\AppData\Local\pnpm\pnpm.EXE
Browsers:
Edge: Chromium (137.0.3296.52)
Severity
annoyance
Describe the bug
It looks like using
setMode('system')somehow breaksmode-watcher.I have a typical three-button mode control: Light, System, and Dark. Everything worked fine until 1.0 release. But now the behavior of
mode-watcheris unstable if the mode is switched sequentially viasetModeandsystemvalue was used.mode.currentstops reflecting the actual mode. However, reloading the page will apply the proper mode that was set last.Reproduction
Just click through Light/System/Dark sequentially in both directions.
Demo: https://sveltekit-mode-watcher.vercel.app/
Source: https://github.com/yellowby/sveltekit-mode-watcher/blob/main/src/routes/%2Bpage.svelte
Logs
System Info
System: OS: Windows 11 10.0.26100 CPU: (32) x64 AMD Ryzen 9 9950X3D 16-Core Processor Memory: 63.18 GB / 95.58 GB Binaries: Node: 22.16.0 - ~\AppData\Local\fnm_multishells\43252_1750065416485\node.EXE npm: 10.9.2 - ~\AppData\Local\fnm_multishells\43252_1750065416485\npm.CMD pnpm: 10.11.0 - ~\AppData\Local\pnpm\pnpm.EXE Browsers: Edge: Chromium (137.0.3296.52)Severity
annoyance