Skip to content

Commit 97ce4cc

Browse files
ychedyesmeck
authored andcommitted
Use an action with an actual type to get the initialSate (#115)
* Use an action with an actual type to get the initialSate Fxes #114 * Fix code style * Fix immutableMultireducer as well * Code style fix
1 parent 7778108 commit 97ce4cc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/immutableMultireducer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ export default function plainMultireducer(reducers, reducerKey) {
1111
}
1212
}
1313

14+
const initAction = { type: '@@multireducer/INIT' };
1415
const initialState = isCustomMountPoint ?
15-
reducers(undefined, {}) :
16-
new Immutable.Map(reducers).map(reducer => reducer(undefined, {}));
16+
reducers(undefined, initAction) :
17+
new Immutable.Map(reducers).map(reducer => reducer(undefined, initAction));
1718

1819
return (state = initialState, action) => {
1920
if (action && action.meta && action.meta[key]) {

src/plainMultireducer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ export default function plainMultireducer(reducers, reducerKey) {
1111
}
1212
}
1313

14+
const initAction = { type: '@@multireducer/INIT' };
1415
const initialState = isCustomMountPoint ?
15-
reducers(undefined, {}) :
16-
mapValues(reducers, reducer => reducer(undefined, {}));
16+
reducers(undefined, initAction) :
17+
mapValues(reducers, reducer => reducer(undefined, initAction));
1718

1819
return (state = initialState, action) => {
1920
if (action && action.meta && action.meta[key]) {

0 commit comments

Comments
 (0)