Skip to content

Commit bfde098

Browse files
committed
🚨 Add error handling for localStorage operations (#1726)
1 parent b9cbed5 commit bfde098

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib/stores/replenishment_workbook.svelte.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ class ReplenishmentWorkBooksStore {
2020
}
2121

2222
const savedStatus = localStorage.getItem(IS_SHOWN_REPLENISHMENT_WORKBOOKS);
23-
return savedStatus ? JSON.parse(savedStatus) : false;
23+
24+
try {
25+
return savedStatus ? JSON.parse(savedStatus) : false;
26+
} catch (error) {
27+
console.warn('Failed to parse replenishment workbooks visibility state:', error);
28+
return false;
29+
}
2430
}
2531

2632
canView() {

0 commit comments

Comments
 (0)