Skip to content

Commit

Permalink
Remove invalid stored item in useLocalStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar committed Sep 10, 2020
1 parent 46a2171 commit 48ae3dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x-pack/plugins/apm/public/hooks/useLocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export function useLocalStorage<T>(key: string, defaultValue: T) {
try {
toStore = JSON.parse(storedItem) as T;
} catch (err) {
// do nothing
window.localStorage.removeItem(key);
// eslint-disable-next-line no-console
console.log(`Unable to decode: ${key}`);
}
}

Expand Down

0 comments on commit 48ae3dd

Please sign in to comment.