From acbc3e9f9be797268843b39d672cfe885a8be3fe Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Tue, 18 Apr 2017 19:27:57 +0100 Subject: [PATCH] move RoomSubList.refreshHeader to apply to the whole RoomSubList again --- src/components/structures/RoomSubList.js | 13 ++++++------- src/components/structures/RoomSubListHeader.js | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index 7656149f..9a2aa1fe 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -73,9 +73,6 @@ var RoomSubList = React.createClass({ order: React.PropTypes.string.isRequired, - // undefined if no room is selected (eg we are showing settings) - selectedRoom: React.PropTypes.string, - startAsHidden: React.PropTypes.bool, showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded collapsed: React.PropTypes.bool.isRequired, // is LeftPanel collapsed? @@ -104,12 +101,14 @@ var RoomSubList = React.createClass({ componentWillMount: function() { constantTimeDispatcher.register("RoomSubList.sort", this.props.tagName, this.onSort); + constantTimeDispatcher.register("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh); this.sortList(this.applySearchFilter(this.props.list, this.props.searchFilter), this.props.order); this._fixUndefinedOrder(this.props.list); }, componentWillUnmount: function() { constantTimeDispatcher.unregister("RoomSubList.sort", this.props.tagName, this.onSort); + constantTimeDispatcher.unregister("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh); }, componentWillReceiveProps: function(newProps) { @@ -124,6 +123,10 @@ var RoomSubList = React.createClass({ // we deliberately don't waste time trying to fix undefined ordering here }, + onRefresh: function() { + this.forceUpdate(); + }, + applySearchFilter: function(list, filter) { if (filter === "") return list; return list.filter((room) => { @@ -370,7 +373,6 @@ var RoomSubList = React.createClass({ var self = this; var DNDRoomTile = sdk.getComponent("rooms.DNDRoomTile"); return this.state.sortedList.map(function(room) { - var selected = room.roomId == self.props.selectedRoom; // XXX: is it evil to pass in self as a prop to RoomTile? return ( 0 || self.props.label === 'Invites' } isInvite={ self.props.label === 'Invites' } refreshSubList={ self._updateSubListCount } incomingCall={ null } diff --git a/src/components/structures/RoomSubListHeader.js b/src/components/structures/RoomSubListHeader.js index 054480f8..5618b39b 100644 --- a/src/components/structures/RoomSubListHeader.js +++ b/src/components/structures/RoomSubListHeader.js @@ -50,16 +50,16 @@ module.exports = React.createClass({ }, componentWillMount: function() { - constantTimeDispatcher.register("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh); + // constantTimeDispatcher.register("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh); }, componentWillUnmount: function() { - constantTimeDispatcher.unregister("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh); + // constantTimeDispatcher.unregister("RoomSubList.refreshHeader", this.props.tagName, this.onRefresh); }, - onRefresh: function() { - this.forceUpdate(); - }, + // onRefresh: function() { + // this.forceUpdate(); + // }, render: function() { var TintableSvg = sdk.getComponent("elements.TintableSvg");