diff options
| author | Adam Soltys <[email protected]> | 2024-11-16 22:17:40 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-16 22:17:40 -0800 |
| commit | 4ebc7d228985748da553c9f4eeb6d3f7d1692375 (patch) | |
| tree | c1fa57adb74ce24799654b9b41aef98f7735cf30 /src | |
| parent | b3653c0a6d448d215c96511ae88c5f3bc741e52f (diff) | |
| download | coinos-ui-4ebc7d228985748da553c9f4eeb6d3f7d1692375.tar.gz coinos-ui-4ebc7d228985748da553c9f4eeb6d3f7d1692375.zip | |
avoid reload
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/+layout.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 5f480c5a..b40aff70 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,4 +1,5 @@ import { browser } from "$app/environment"; +import { theme as themeStore } from "$lib/store"; import { addTranslations, setLocale, setRoute } from "$lib/translations/index"; import { addIcon } from "iconify-icon"; import cookies from "js-cookie"; @@ -25,7 +26,7 @@ export const load = async ({ data }) => { expires.setSeconds(expires.getSeconds() + 21000000); cookies.set("theme", theme, { path: "/", expires }); - if (theme === "dark") location.reload(); + if (theme === "dark") setTimeout(() => themeStore.set(theme), 100); } } }; |
