Skip to content

Commit cb3dbab

Browse files
committed
ignore invalid entries in localstorage
1 parent 20ae0c9 commit cb3dbab

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/components/context/storage.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const reducer: Reducer<State, Actions> = (state, action) => {
4040
};
4141

4242
const storage = Object.entries(localStorage).reduce((record: State, [key, value]: [string, string]) => {
43+
if (!is(schemas.dataset, value)) return record;
4344
return { ...record, [key]: JSON.parse(value) as T };
4445
}, {});
4546

0 commit comments

Comments
 (0)