Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Fixed issue 'Unexpected key counter found in previous state received … #1059

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/store/createStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default (initialState = {}) => {
// Store Instantiation and HMR Setup
// ======================================================
const store = createStore(
makeRootReducer(),
makeRootReducer({}, initialState),
initialState,
compose(
applyMiddleware(...middleware),
Expand Down
13 changes: 11 additions & 2 deletions src/store/reducers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { combineReducers } from 'redux'
import locationReducer from './location'

export const makeRootReducer = (asyncReducers) => {
export const makeRootReducer = (asyncReducers, initialState) => {
let missingReducers = { }
if (initialState !== undefined && typeof initialState === 'object') {
for (let key in initialState) {
if (!asyncReducers.hasOwnProperty(key)) {
missingReducers[key] = () => initialState[key]
}
}
}
return combineReducers({
location: locationReducer,
...asyncReducers
...asyncReducers,
...missingReducers
})
}

Expand Down