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 = (): [
5454export function initAgentFromLocalStorage ( ) : Agent | undefined {
5555 const lsItem = localStorage . getItem ( AGENT_LOCAL_STORAGE_KEY ) ;
5656
57- if ( lsItem === null || lsItem === undefined ) {
57+ if ( lsItem === null || lsItem === undefined || lsItem === 'undefined' ) {
5858 return undefined ;
5959 }
6060
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ export function useLocalStorage<T>(
1717 // Get from local storage by key
1818 const item = window . localStorage . getItem ( key ) ;
1919
20+ if ( item === 'undefined' ) {
21+ return initialValue ;
22+ }
23+
2024 // Parse stored json or if none return initialValue
2125 return item ? JSON . parse ( item ) : initialValue ;
2226 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments