web: make everything ssr-compatible

This commit is contained in:
dumbmoron
2024-08-31 17:46:10 +00:00
parent 4b4fce326f
commit 51c140fbfa
9 changed files with 91 additions and 53 deletions

View File

@@ -1,4 +1,5 @@
import { derived, readable, type Updater } from 'svelte/store';
import { browser } from '$app/environment';
import { merge } from 'ts-deepmerge';
import type {
@@ -43,6 +44,9 @@ const migrate = (settings: AllPartialSettingsWithSchema): PartialSettings => {
const loadFromStorage = () => {
if (!browser)
return {};
const settings = localStorage.getItem('settings');
if (!settings) {
const migrated = migrateOldSettings();