From b3ac58a43e5c604a460e7cfcd6100a6d644f15c6 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 3 Mar 2026 09:10:14 -0800 Subject: refactor(effect): harden settings and media cache json parsing --- src/stores/settings.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/stores') diff --git a/src/stores/settings.ts b/src/stores/settings.ts index e960eff6..263b7d43 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -1,4 +1,5 @@ import { browser } from "$app/environment"; +import { parseJsonStringOrDefault } from "$lib/Effect/json"; import root from "$lib/Utility/root"; import { get, writable } from "svelte/store"; import settingsSyncPulled from "./settingsSyncPulled"; @@ -144,8 +145,9 @@ const defaultSettings: Settings = { const createStore = () => { const initialValue = browser - ? JSON.parse( - localStorage.getItem("settings") || JSON.stringify(defaultSettings), + ? parseJsonStringOrDefault( + localStorage.getItem("settings") || "", + defaultSettings, ) : defaultSettings; const store = writable(initialValue); -- cgit v1.2.3