From 4ebc7d228985748da553c9f4eeb6d3f7d1692375 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 16 Nov 2024 22:17:40 -0800 Subject: avoid reload --- src/routes/+layout.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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); } } }; -- cgit v1.2.3