Merge pull request #1807 from matrix-org/luke/fix-room-tile-badge-flicker

Fix room tile badge not disappearing when receiving a read receipt
pull/21833/head
David Baker 2018-03-20 17:26:50 +00:00 committed by GitHub
commit 55aeac6990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -146,6 +146,15 @@ module.exports = React.createClass({
dis.unregister(this.dispatcherRef);
},
componentWillReceiveProps: function(props) {
// XXX: This could be a lot better - this makes the assumption that
// the notification count may have changed when the properties of
// the room tile change.
this.setState({
notificationCount: this.props.room.getUnreadNotificationCount(),
});
},
// Do a simple shallow comparison of props and state to avoid unnecessary
// renders. The assumption made here is that only state and props are used
// in rendering this component and children.