Revert "Revert "Merge pull request #193 from matrix-org/rav/shouldComponentUpdates""

Put the shouldComponentUpdate methods back in, now that Matthew has stopped
demoing.

This reverts commit 606fdcb8df.
This commit is contained in:
Richard van der Hoff 2016-03-07 22:27:35 +00:00
parent a9da0a014e
commit 393e8ff612
3 changed files with 43 additions and 0 deletions

View file

@ -38,6 +38,7 @@ var SlashCommands = require("../../SlashCommands");
var dis = require("../../dispatcher");
var Tinter = require("../../Tinter");
var rate_limited_func = require('../../ratelimitedfunc');
var ObjectUtils = require('../../ObjectUtils');
var DEBUG = false;
@ -164,6 +165,11 @@ module.exports = React.createClass({
}
},
shouldComponentUpdate: function(nextProps, nextState) {
return (!ObjectUtils.shallowEqual(this.props, nextProps) ||
!ObjectUtils.shallowEqual(this.state, nextState));
},
componentWillUnmount: function() {
// set a boolean to say we've been unmounted, which any pending
// promises can use to throw away their results.