diff --git a/resources/scripts/plugins/usePersistedState.ts b/resources/scripts/plugins/usePersistedState.ts index 007e3fcde..034e81e1c 100644 --- a/resources/scripts/plugins/usePersistedState.ts +++ b/resources/scripts/plugins/usePersistedState.ts @@ -6,7 +6,11 @@ export function usePersistedState (key: string, defaultValue: S): try { const item = localStorage.getItem(key); - return JSON.parse(item || (String(defaultValue))); + if (item === null) { + return defaultValue; + } + + return JSON.parse(item || String(defaultValue)); } catch (e) { console.warn('Failed to retrieve persisted value from store.', e);