Avoid rerendering during Room unmount

might speed up room changing by a few milliseconds
This commit is contained in:
Richard van der Hoff 2016-04-22 17:03:15 +01:00
parent 0fd0b0c5f3
commit ca0c697b6e
3 changed files with 30 additions and 0 deletions

View file

@ -85,6 +85,12 @@ module.exports = React.createClass({
// opaque readreceipt info for each userId; used by ReadReceiptMarker
// to manage its animations
this._readReceiptMap = {};
this._isMounted = true;
},
componentWillUnmount: function() {
this._isMounted = false;
},
/* get the DOM node representing the given event */
@ -201,6 +207,10 @@ module.exports = React.createClass({
}
},
_isUnmounting: function() {
return !this._isMounted;
},
_getEventTiles: function() {
var EventTile = sdk.getComponent('rooms.EventTile');
@ -351,6 +361,7 @@ module.exports = React.createClass({
onWidgetLoad={this._onWidgetLoad}
readReceipts={readReceipts}
readReceiptMap={this._readReceiptMap}
checkUnmounting={this._isUnmounting}
eventSendStatus={mxEv.status}
last={last} isSelectedEvent={highlight}/>
</li>