Use new js-sdk modified time to avoid unnecessary member tile updates. Also avoid double-updating since we were setting state and then forcing an update which is redundant.
This commit is contained in:
parent
17c81c1101
commit
1dd707775a
2 changed files with 23 additions and 1 deletions
|
@ -31,6 +31,23 @@ module.exports = React.createClass({
|
|||
displayName: 'MemberTile',
|
||||
mixins: [MemberTileController],
|
||||
|
||||
shouldComponentUpdate: function(nextProps, nextState) {
|
||||
if (
|
||||
this.member_last_modified_time === undefined ||
|
||||
this.member_last_modified_time < nextProps.member.getLastModifiedTime()
|
||||
) {
|
||||
return true
|
||||
}
|
||||
if (
|
||||
nextProps.member.user &&
|
||||
(this.user_last_modified_time === undefined ||
|
||||
this.user_last_modified_time < nextProps.member.user.getLastModifiedTime())
|
||||
) {
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
mouseEnter: function(e) {
|
||||
this.setState({ 'hover': true });
|
||||
},
|
||||
|
@ -93,6 +110,11 @@ module.exports = React.createClass({
|
|||
},
|
||||
|
||||
render: function() {
|
||||
this.member_last_modified_time = this.props.member.getLastModifiedTime();
|
||||
if (this.props.member.user) {
|
||||
this.user_last_modified_time = this.props.member.user.getLastModifiedTime();
|
||||
}
|
||||
|
||||
var isMyUser = MatrixClientPeg.get().credentials.userId == this.props.member.userId;
|
||||
|
||||
var power;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue