Skip to content

Commit e6806f6

Browse files
committed
Bugfix: Remove double-passed childProps.
Has performance implications only.
1 parent 6bb23cd commit e6806f6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/RouteRenderingMixin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ var RouteRenderingMixin = {
2020
return childProps;
2121
},
2222

23-
renderRouteHandler: function(props) {
23+
renderRouteHandler: function() {
2424
if (!this.state.match.route) {
2525
throw new Error("React-router-component: No route matched! Did you define a NotFound route?");
2626
}
2727
var handler = this.state.handler;
2828
var matchProps = this.state.matchProps;
29+
var outProps = assign({ref: this.state.match.route.ref}, this.getChildProps(), matchProps);
2930

30-
props = assign({ref: this.state.match.route.ref}, this.getChildProps(), props, matchProps);
3131
// If we were passed an element, we need to clone it before passing it along.
3232
if (React.isValidElement(handler)) {
3333
// Be sure to keep the props that were already set on the handler.
3434
// Otherwise, a handler like <div className="foo">bar</div> would have its className lost.
35-
return React.cloneElement(handler, assign(props, handler.props));
35+
return React.cloneElement(handler, assign(outProps, handler.props));
3636
}
37-
return React.createElement(handler, props);
37+
return React.createElement(handler, outProps);
3838
}
3939

4040
};

lib/Router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function createRouter(name, component) {
3131

3232
render: function() {
3333
// Render the Route's handler.
34-
var handler = this.renderRouteHandler(this.props.childProps);
34+
var handler = this.renderRouteHandler();
3535

3636
if (!this.props.component) {
3737
return handler;

0 commit comments

Comments
 (0)