From 1d976947e17c499569509014b8343c84d61094a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Sun, 29 Sep 2024 20:27:06 +0200 Subject: [PATCH] fix: server load interferes with spa --- src/lib/style/{theme.server.ts => theme.ts} | 0 src/routes/(app)/+layout.server.ts | 12 ------------ src/routes/(app)/+layout.ts | 5 ++++- src/routes/(app)/ota-update/+layout.ts | 2 -- vite.config.ts | 2 +- 5 files changed, 5 insertions(+), 16 deletions(-) rename src/lib/style/{theme.server.ts => theme.ts} (100%) delete mode 100644 src/routes/(app)/+layout.server.ts delete mode 100644 src/routes/(app)/ota-update/+layout.ts diff --git a/src/lib/style/theme.server.ts b/src/lib/style/theme.ts similarity index 100% rename from src/lib/style/theme.server.ts rename to src/lib/style/theme.ts diff --git a/src/routes/(app)/+layout.server.ts b/src/routes/(app)/+layout.server.ts deleted file mode 100644 index e435354d..00000000 --- a/src/routes/(app)/+layout.server.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { - themeBase, - themeColor, - themeSuccessBase, -} from "$lib/style/theme.server"; -import type { LayoutServerLoad } from "./$types"; - -export const load = (async () => ({ - themeSuccessBase, - themeBase, - themeColor, -})) satisfies LayoutServerLoad; diff --git a/src/routes/(app)/+layout.ts b/src/routes/(app)/+layout.ts index f70ad33c..fe2c9eff 100644 --- a/src/routes/(app)/+layout.ts +++ b/src/routes/(app)/+layout.ts @@ -1,11 +1,14 @@ import type { LayoutLoad } from "./$types"; import { browser } from "$app/environment"; import { charaFileFromUriComponent } from "$lib/share/share-url"; +import { themeBase, themeColor, themeSuccessBase } from "$lib/style/theme"; export const load = (async ({ url, data, fetch }) => { const importFile = browser && new URLSearchParams(url.search).get("import"); return { - ...data, + themeSuccessBase, + themeBase, + themeColor, importFile: importFile ? await charaFileFromUriComponent(importFile, fetch) : undefined, diff --git a/src/routes/(app)/ota-update/+layout.ts b/src/routes/(app)/ota-update/+layout.ts deleted file mode 100644 index ae88a275..00000000 --- a/src/routes/(app)/ota-update/+layout.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const prerender = false; -export const ssr = false; diff --git a/vite.config.ts b/vite.config.ts index 97072a81..3d802e4d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,5 @@ // noinspection ES6PreferShortImport -import { themeColor } from "./src/lib/style/theme.server"; +import { themeColor } from "./src/lib/style/theme"; import { sveltekit } from "@sveltejs/kit/vite"; import { defineConfig } from "vite"; import { SvelteKitPWA } from "@vite-pwa/sveltekit";