Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/site-kit/src/lib/state/Persisted.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ export class Persisted<T extends string = string> {
this.#subscribe(); // handle cross-tab updates
this.#version; // handle same-tab updates

return (this.#storage?.getItem(this.#key) as T) ?? this.#fallback;
}
try {
return (this.#storage?.getItem(this.#key) as T) ?? this.#fallback;
} catch {
return this.#fallback;
}
}

set current(v: T) {
this.#storage?.setItem(this.#key, v);
Expand Down