File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export const useCurrentAgent = (): [
54
54
export function initAgentFromLocalStorage ( ) : Agent | undefined {
55
55
const lsItem = localStorage . getItem ( AGENT_LOCAL_STORAGE_KEY ) ;
56
56
57
- if ( lsItem === null || lsItem === undefined ) {
57
+ if ( lsItem === null || lsItem === undefined || lsItem === 'undefined' ) {
58
58
return undefined ;
59
59
}
60
60
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ export function useLocalStorage<T>(
17
17
// Get from local storage by key
18
18
const item = window . localStorage . getItem ( key ) ;
19
19
20
+ if ( item === 'undefined' ) {
21
+ return initialValue ;
22
+ }
23
+
20
24
// Parse stored json or if none return initialValue
21
25
return item ? JSON . parse ( item ) : initialValue ;
22
26
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments