Skip to content

Commit

Permalink
Prevent "when" childProps from clobbering "listen" chlidProps (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyHYK authored and gigabo committed Sep 30, 2016
1 parent ece8edf commit cbf8256
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-server/core/components/RootElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ RootElement.scheduleRender = function(element) {
.then(el => el && (rendered = el))
.then(() => when)
.then(childProps => childProps
?React.cloneElement(rendered, {childProps})
// merge "when" childProps and "listen" childProps preemptively
// to prevent cloneElement shallow merge from clobbering "listen" childProps
?React.cloneElement(rendered, {childProps: _.assign({}, rendered.props.childProps || {}, childProps)})
:rendered
)
}

0 comments on commit cbf8256

Please sign in to comment.