mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
Merge pull request #3685 from urbit/ted/fix-local-storage-rehydrate
LocalReducer: fix empty case of localStorage rehydration
This commit is contained in:
commit
8559d9d7de
@ -8,7 +8,7 @@ type LocalState = Pick<StoreState, 'sidebarShown' | 'omniboxShown' | 'baseHash'
|
||||
export default class LocalReducer<S extends LocalState> {
|
||||
rehydrate(state: S) {
|
||||
try {
|
||||
const json = JSON.parse(localStorage.getItem('localReducer') || '');
|
||||
const json = JSON.parse(localStorage.getItem('localReducer') || '{}');
|
||||
_.forIn(json, (value, key) => {
|
||||
state[key] = value;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user