Skip to content

Commit

Permalink
Test if save/load state is working properly (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan authored Aug 28, 2024
1 parent 6a1a8b5 commit 322defa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const loadState = (): RootState => {
}
return { ...serializedState, apiSession };
} catch (err) {
console.error('Error in loading state. Resetting!');
return ({} as RootState);
}
};
Expand All @@ -37,5 +38,6 @@ export const saveState = (state: RootState) => {
}
globalThis.sessionStorage.setItem('state', JSON.stringify(state));
} catch (err) { // Ignore write errors.
console.error('Error in saving state');
}
};

0 comments on commit 322defa

Please sign in to comment.