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.
parent
17c81c1101
commit
1dd707775a
|
@ -27,7 +27,7 @@
|
|||
"filesize": "^3.1.2",
|
||||
"flux": "~2.0.3",
|
||||
"linkifyjs": "^2.0.0-beta.4",
|
||||
"matrix-js-sdk": "^0.2.1",
|
||||
"matrix-js-sdk": "^0.2.2",
|
||||
"matrix-react-sdk": "^0.0.1",
|
||||
"q": "^1.4.1",
|
||||
"react": "^0.13.3",
|
||||
|
|
|
@ -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…
Reference in New Issue