Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: useLocalStorageQuery error logs

Greg Richardson19a4e0bf1e43
diff --git a/studio/hooks/misc/useLocalStorage.ts b/studio/hooks/misc/useLocalStorage.ts
index 222ac15dfcf..3039112a688 100644
--- a/studio/hooks/misc/useLocalStorage.ts
+++ b/studio/hooks/misc/useLocalStorage.ts
@@ -57,13 +57,13 @@ export function useLocalStorageQuery<T>(key: string, initialValue: T) {
const { data: storedValue = initialValue } = useQuery(queryKey, () => {
if (typeof window === 'undefined') {
- throw new Error('Window not defined')
+ return initialValue
}
const item = window.localStorage.getItem(key)
if (!item) {
- throw new Error(`No item exists for key '${key}'`)
+ return initialValue
}
return JSON.parse(item) as T