mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Revert "Merge pull request #193 from matrix-org/rav/shouldComponentUpdates"
This reverts commita7c75b1315
, reversing changes made tob66ca74ede
. This is causing breakage in the messagepanel screen resize after video call and room settings
This commit is contained in:
parent
a2c6bd0e6c
commit
606fdcb8df
@ -77,34 +77,3 @@ module.exports.getKeyValueArrayDiffs = function(before, after) {
|
|||||||
|
|
||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Shallow-compare two objects for equality: each key and value must be
|
|
||||||
* identical
|
|
||||||
*/
|
|
||||||
module.exports.shallowEqual = function(objA, objB) {
|
|
||||||
if (objA === objB) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof objA !== 'object' || objA === null ||
|
|
||||||
typeof objB !== 'object' || objB === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var keysA = Object.keys(objA);
|
|
||||||
var keysB = Object.keys(objB);
|
|
||||||
|
|
||||||
if (keysA.length !== keysB.length) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < keysA.length; i++) {
|
|
||||||
var key = keysA[i];
|
|
||||||
if (!objB.hasOwnProperty(key) || objA[key] !== objB[key]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
@ -38,7 +38,6 @@ var SlashCommands = require("../../SlashCommands");
|
|||||||
var dis = require("../../dispatcher");
|
var dis = require("../../dispatcher");
|
||||||
var Tinter = require("../../Tinter");
|
var Tinter = require("../../Tinter");
|
||||||
var rate_limited_func = require('../../ratelimitedfunc');
|
var rate_limited_func = require('../../ratelimitedfunc');
|
||||||
var ObjectUtils = require('../../ObjectUtils');
|
|
||||||
|
|
||||||
var DEBUG = false;
|
var DEBUG = false;
|
||||||
|
|
||||||
@ -165,11 +164,6 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldComponentUpdate: function(nextProps, nextState) {
|
|
||||||
return (!ObjectUtils.shallowEqual(this.props, nextProps) ||
|
|
||||||
!ObjectUtils.shallowEqual(this.state, nextState));
|
|
||||||
},
|
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
// set a boolean to say we've been unmounted, which any pending
|
// set a boolean to say we've been unmounted, which any pending
|
||||||
// promises can use to throw away their results.
|
// promises can use to throw away their results.
|
||||||
|
@ -24,7 +24,6 @@ var EventTimeline = Matrix.EventTimeline;
|
|||||||
var sdk = require('../../index');
|
var sdk = require('../../index');
|
||||||
var MatrixClientPeg = require("../../MatrixClientPeg");
|
var MatrixClientPeg = require("../../MatrixClientPeg");
|
||||||
var dis = require("../../dispatcher");
|
var dis = require("../../dispatcher");
|
||||||
var ObjectUtils = require('../../ObjectUtils');
|
|
||||||
|
|
||||||
var PAGINATE_SIZE = 20;
|
var PAGINATE_SIZE = 20;
|
||||||
var INITIAL_SIZE = 20;
|
var INITIAL_SIZE = 20;
|
||||||
@ -147,11 +146,6 @@ var TimelinePanel = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldComponentUpdate: function(nextProps, nextState) {
|
|
||||||
return (!ObjectUtils.shallowEqual(this.props, nextProps) ||
|
|
||||||
!ObjectUtils.shallowEqual(this.state, nextState));
|
|
||||||
},
|
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
// set a boolean to say we've been unmounted, which any pending
|
// set a boolean to say we've been unmounted, which any pending
|
||||||
// promises can use to throw away their results.
|
// promises can use to throw away their results.
|
||||||
|
Loading…
Reference in New Issue
Block a user