From 0fd0b0c5f3adcaf740662f1e6815a862746b3666 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 22 Apr 2016 17:05:48 +0100 Subject: [PATCH 1/4] Whitespace fixes Fix some trailing whitespace --- src/components/structures/MatrixChat.js | 2 +- src/components/structures/RoomView.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 09583951fc..fca688ee15 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1181,7 +1181,7 @@ module.exports = React.createClass({ defaultIsUrl={this.props.config.default_is_url} customHsUrl={this.getCurrentHsUrl()} customIsUrl={this.getCurrentIsUrl()} - onForgotPasswordClick={this.onForgotPasswordClick} + onForgotPasswordClick={this.onForgotPasswordClick} onLoginAsGuestClick={this.props.enableGuest && this.props.config && this.props.config.default_hs_url ? this._registerAsGuest.bind(this, true) : undefined} onCancelClick={ this.state.guestCreds ? this.onReturnToGuestClick : null } /> diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index ac848030af..9b8322f69e 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -210,7 +210,7 @@ module.exports = React.createClass({ MatrixClientPeg.get().removeListener("RoomState.members", this.onRoomStateMember); } - window.removeEventListener('resize', this.onResize); + window.removeEventListener('resize', this.onResize); // no need to do this as Dir & Settings are now overlays. It just burnt CPU. // console.log("Tinter.tint from RoomView.unmount"); @@ -878,7 +878,7 @@ module.exports = React.createClass({ this.setState({ uploadingRoomSettings: true, }); - + var newName = this.refs.header.getEditedName(); if (newName !== undefined) { this.refs.room_settings.setName(newName); @@ -887,7 +887,7 @@ module.exports = React.createClass({ if (newTopic !== undefined) { this.refs.room_settings.setTopic(newTopic); } - + this.refs.room_settings.save().then((results) => { var fails = results.filter(function(result) { return result.state !== "fulfilled" }); console.log("Settings saved with %s errors", fails.length); @@ -1229,7 +1229,7 @@ module.exports = React.createClass({ rightPanelCollapsed={ this.props.rightPanelCollapsed } />
-
- - {call.isMicrophoneMuted()
From ca0c697b6e3e1fcdb2b95f8cdd00757c546866d2 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 22 Apr 2016 17:03:15 +0100 Subject: [PATCH 2/4] Avoid rerendering during Room unmount might speed up room changing by a few milliseconds --- src/components/structures/MessagePanel.js | 11 +++++++++++ src/components/views/rooms/EventTile.js | 7 +++++++ src/components/views/rooms/ReadReceiptMarker.js | 12 ++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/components/structures/MessagePanel.js b/src/components/structures/MessagePanel.js index 49f4783eaa..16b4892bc0 100644 --- a/src/components/structures/MessagePanel.js +++ b/src/components/structures/MessagePanel.js @@ -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}/> diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 5c70c9da10..7db8af9312 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -116,6 +116,12 @@ module.exports = React.createClass({ */ readReceiptMap: React.PropTypes.object, + /* A function which is used to check if the parent panel is being + * unmounted, to avoid unnecessary work. Should return true if we + * are being unmounted. + */ + checkUnmounting: React.PropTypes.func, + /* the status of this event - ie, mxEvent.status. Denormalised to here so * that we can tell when it changes. */ eventSendStatus: React.PropTypes.string, @@ -261,6 +267,7 @@ module.exports = React.createClass({
This invitation was sent to {this.props.invitedEmail}, which is not associated with this account.
- You may wish to login with a different account, or add this email to your this account. + You may wish to login with a different account, or add this email to this account.
}