-
Notifications
You must be signed in to change notification settings - Fork 22
Add mergeProps argument #20
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
Conversation
|
Shouldn't actionProps be the last argument seen it will be the least used? |
|
Won't all of them almost always be used? Otherwise your function would be discarding arguments. |
|
|
I reordered the arguments in the latest commit, let me know what you think. |
|
Can you give an example where it is necessary to have subscriptionProps and actionProps as seperate arguments?
|
|
We could merge them before passing them into const assignCustomizer = (objectValue, sourceValue) => (
_.isNil(objectValue) ? sourceValue : objectValue
)
const customMergeProps = (actionProps, subscriptionProps, ownProps) => {
const cascadedProps = _.assignWith({}, ownProps, subscriptionProps, assignCustomizer)
return {
...actionProps,
...cascadedProps
}
} |
src/connect.js
Outdated
| const actionProps = pickBy(firebaseProps, isFunction) | ||
| const subscriptionProps = this.state.subscriptionsState | ||
| const props = mergeProps(actionProps, subscriptionProps, this.props) | ||
| const props = mergeProps(this.props, subscriptionProps, actionProps) |
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.
Why can't we do
const props = mergeProps(this.props, { ...actionProps, ...subscriptionProps })instead? Why should the developer get three arguments to mergeProps?
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.
If you'd want to add defaults to subscriptionProps as in the example above you would have to filter out actionProps by checking if they are functions or values.
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.
Could you give an example?
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.
…t-firebase into issue-19-merge-props
|
Once again, Circle refuses to run tests so I'm merging this manually. |
Closes #19