Avoid rerendering during Room unmount
might speed up room changing by a few milliseconds
This commit is contained in:
parent
0fd0b0c5f3
commit
ca0c697b6e
3 changed files with 30 additions and 0 deletions
|
@ -53,6 +53,11 @@ module.exports = React.createClass({
|
|||
// this room
|
||||
readReceiptInfo: 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,
|
||||
|
||||
// callback for clicks on this RR
|
||||
onClick: React.PropTypes.func,
|
||||
},
|
||||
|
@ -81,6 +86,13 @@ module.exports = React.createClass({
|
|||
return;
|
||||
}
|
||||
|
||||
// checking the DOM properties can force a re-layout, which can be
|
||||
// quite expensive; so if the parent messagepanel is being unmounted,
|
||||
// then don't bother with this.
|
||||
if (this.props.checkUnmounting && this.props.checkUnmounting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var avatarNode = ReactDOM.findDOMNode(this);
|
||||
rrInfo.top = avatarNode.offsetTop;
|
||||
rrInfo.left = avatarNode.offsetLeft;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue