-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api changes, thunks support added #103
Conversation
This reverts commit 4da07b1.
To get the build to work on Node 0.12, please change action.type.includes(key) to ~action.type.indexOf(key) on |
@erikras fixed. Relied on babel here) Expected |
api changes, thunks support added. fixes #9
multireducerBind(actions, multireducerKey) | ||
wrapMapStateToProps(mapStateToProps, multireducerKey), | ||
wrapMapDispatchToProps(mapDispatchToProps, multireducerKey), | ||
...rest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsdmc Somewhere in here, you lost the BUT WITH ONE DIFFERENCE logic that was slicing up the state to only the slice that the reducer wants. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or am I expected, as the user of the library, to slice my own state: state.multireducer[key]
in mapStateToProps
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erikras Oh, sorry if described it not clear. But yes you need to use that key
to access state slice. Yeah, it's not that convenient as in previous version, but at the other hand you have access to app state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Can you do another PR to fix the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erikras done
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. |
@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 accessmultireducerKey
fromownProps
, but as you mentioned earlier, react-redux'sconnect
makes some optimizations - thus it's better not to useownProps
if it's not used. Also now whole state passed tomapStateToProps
. I think it's more flexible way. You can still grab needed state slice usingkey
param.@adailey14 Please take a look as there is a bunch of your changes)