svecosystem / mode-watcher

Simple light/dark mode management for SvelteKit apps. 🌑 ←→ ☀️
https://mode-watcher.svecosystem.com
MIT License
315 stars 12 forks source link

Custom mode storage key only partially respected #93

Open zerosym opened 2 months ago

zerosym commented 2 months ago

Describe the bug

After setting custom values for both theme and mode storage keys (and clearing my local storage) I noticed that the default mode-watcher-mode key still appears in addition to the custom ones.

https://github.com/svecosystem/mode-watcher/blob/37bbc9de578b9bfba54c610bbad054cdfeb9c6d6/packages/mode-watcher/src/lib/mode.ts#L50

Just a quick glance at the code and it seems in the setup function the keys are still hardcoded strings rather than using the parameters.

Reproduction

 <ModeWatcher themeStorageKey="my-theme" modeStorageKey="my-mode" />

Logs

No response

System Info

npmPackages:
    @sveltejs/kit: ^2.0.0 => 2.5.17
    mode-watcher: ^0.4.1 => 0.4.1
    svelte: ^5.0.0-next.208 => 5.0.0-next.208

Severity

annoyance

zerosym commented 2 months ago

Noticed https://github.com/svecosystem/mode-watcher/pull/89 includes a fix for this.