gajus / redux-immutable

redux-immutable is used to create an equivalent function of Redux combineReducers that works with Immutable.js state.
Other
1.88k stars 82 forks source link

Support nested reducers #24

Closed mathisonian closed 8 years ago

mathisonian commented 8 years ago

As discussed in #22, this PR adds support for nested combineReducers calls by defaulting to an empty immutable map if the inputState is undefined.

This adds a test for this behavior as well.

gajus commented 8 years ago

This makes immutable a direct dependency, i.e. requires removing immutable from peerDependencies and devDependencies and adding to dependencies.

mathisonian commented 8 years ago

updated.

holymonson commented 8 years ago

This mgiht be simpler:

@@ -10,7 +11,7 @@ export default (reducers: Object) => {

     reducerKeys = Object.keys(reducers);

-    return (inputState, action) => {
+    return (inputState = Immutable.Map(), action) => {
         /* eslint-disable no-process-env */
         if (process.env.NODE_ENV !== 'production') {
         /* eslint-enable no-process-env */
mathisonian commented 8 years ago

I'll defer to @gajus on the style. happy to update the PR