Skip to content

Commit

Permalink
ReactDOMComponent optimization
Browse files Browse the repository at this point in the history
Slight optimization to not do unneeded reconciles of DOM components
  • Loading branch information
petehunt authored and zpao committed Mar 10, 2014
1 parent 3ea3274 commit 5ede7fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
File renamed without changes.
9 changes: 9 additions & 0 deletions src/browser/ui/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5ede7fb

Please sign in to comment.