Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Commit a908b53

Browse files
authored
Merge pull request #16 from piotr-roslaniec/fix-undefined-state
Dispatch action to init reducer state
2 parents 5ec626d + 95759c5 commit a908b53

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

app/configureStore.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default function configureStore(initialState = {}, history) {
5353
if (module.hot) {
5454
module.hot.accept('./reducers', () => {
5555
store.replaceReducer(createReducer(store.injectedReducers));
56+
store.dispatch({ type: '@@REDUCER_INJECTED' });
5657
});
5758
}
5859

app/utils/reducerInjectors.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function injectReducerFactory(store, isValid) {
2020

2121
store.injectedReducers[key] = reducer; // eslint-disable-line no-param-reassign
2222
store.replaceReducer(createReducer(store.injectedReducers));
23+
store.dispatch({ type: '@@REDUCER_INJECTED' });
2324
};
2425
}
2526

app/utils/tests/reducerInjectors.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ describe('reducer injectors', () => {
6060
});
6161

6262
it('it should not check a store if the second argument is true', () => {
63-
Reflect.deleteProperty(store, 'dispatch');
64-
6563
expect(() => injectReducer('test', reducer)).not.toThrow();
6664
});
6765

0 commit comments

Comments
 (0)