Skip to content

Commit 4a55ddf

Browse files
authored
add check for partial state loading (#378)
1 parent 81b3e85 commit 4a55ddf

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

client/containers/domain-autocomplete/reducer.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
import { migrateRecentDomains } from './helpers';
2323

24-
const reducer = state => ({
25-
...state,
26-
visitedDomainList: migrateRecentDomains(state.visitedDomainList),
27-
});
24+
const reducer = state =>
25+
state && {
26+
...state,
27+
visitedDomainList: migrateRecentDomains(state.visitedDomainList),
28+
};
2829

2930
export default reducer;

client/store/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,15 @@ const getStoreConfig = ({ router, state }) => {
9292
return;
9393
}
9494

95+
const domainAutocomplete = domainAutocompleteReducer(
96+
state.domainAutocomplete
97+
);
98+
9599
return {
96100
...state,
97-
domainAutocomplete: domainAutocompleteReducer(state.domainAutocomplete),
101+
...(domainAutocomplete && {
102+
domainAutocomplete,
103+
}),
98104
};
99105
},
100106
storage: window.localStorage,

0 commit comments

Comments
 (0)