From 856c499541570b641dce6e2262b898f832eb4882 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 20 Mar 2018 17:19:49 +0000 Subject: [PATCH] Fix room tile badge not disappearing when receiving a read receipt Fixes https://github.com/vector-im/riot-web/issues/6357 --- src/components/views/rooms/RoomTile.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/views/rooms/RoomTile.js b/src/components/views/rooms/RoomTile.js index 448810e2ea..05aaf79e0b 100644 --- a/src/components/views/rooms/RoomTile.js +++ b/src/components/views/rooms/RoomTile.js @@ -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.