aboutsummaryrefslogtreecommitdiff
path: root/src/stores
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/settings.ts6
1 files changed, 4 insertions, 2 deletions
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<Settings>(initialValue);