ReactDOMComponent optimization

Slight optimization to not do unneeded reconciles of DOM components
This commit is contained in:
Pete Hunt
2014-03-10 15:32:20 -07:00
committed by Paul O’Shannessy
parent 3ea3274ca4
commit 5ede7fb619
3 changed files with 9 additions and 0 deletions
+9
View File
@@ -206,6 +206,15 @@ ReactDOMComponent.Mixin = {
},
receiveComponent: function(nextComponent, transaction) {
if (nextComponent === this) {
// Since props and context are immutable after the component is
// mounted, we can do a cheap identity compare here to determine
// if this is a superfluous reconcile.
// TODO: compare the descriptor
return;
}
assertValidProps(nextComponent.props);
ReactComponent.Mixin.receiveComponent.call(
this,