Refresh room & member avatars when a roommember.name event comes in

This commit is contained in:
David Baker 2015-10-28 15:15:35 +00:00
parent a850f19cd4
commit 2365fe8ceb
5 changed files with 52 additions and 7 deletions

View file

@ -41,10 +41,29 @@ module.exports = {
},
componentWillReceiveProps: function(nextProps) {
this._update();
this.setState({
imageUrl: this._nextUrl()
});
this.refreshImageUrl();
},
refreshImageUrl: function(nextProps) {
// If the list has changed, we start from scratch and re-check, but
// don't do so unless the list has changed or we'd re-try fetching
// images each time we re-rendered
var newList = this.getUrlList();
var differs = false;
for (var i = 0; i < newList.length && i < this.urlList.length; ++i) {
if (this.urlList[i] != newList[i]) differs = true;
}
if (this.urlList.length != newList.length) differs = true;
if (differs) {
console.log("list differs");
this._update();
this.setState({
imageUrl: this._nextUrl()
});
} else {
console.log("list is the same");
}
},
_update: function() {