erikras / multireducer

A utility to wrap many copies of a single Redux reducer into a single key-based reducer.
MIT License
422 stars 23 forks source link

api changes, thunks support added #103

Closed jsdmc closed 8 years ago

jsdmc commented 8 years ago

@erikras Breaking change is only for mapStateToProps(key, state, ownProps). Now it's first argument is a multireducerKey passed to component. We can keep old signature and access multireducerKey from ownProps, but as you mentioned earlier, react-redux's connect makes some optimizations - thus it's better not to use ownProps if it's not used. Also now whole state passed to mapStateToProps. I think it's more flexible way. You can still grab needed state slice using key param. @adailey14 Please take a look as there is a bunch of your changes)

erikras commented 8 years ago

To get the build to work on Node 0.12, please change

action.type.includes(key)

to

~action.type.indexOf(key)

on multireducer.js:17. Such a great js hack, that one. :-)

jsdmc commented 8 years ago

@erikras fixed. Relied on babel here) Expected includes to work after transpiling. The same issue with find method of Arrays.

danosaure commented 8 years ago

This change kind of break encapsulation. I was using multireducer to not need to know where in the tree the "sub-state" is, now, it seems that I need to be aware of the whole state.