From 7cc1573f335ef19527a022509e883244fc27a83d Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 18 Dec 2015 15:17:18 +0000 Subject: [PATCH] Add startAsHidden and showSpinner props to RoomSubList startAsHidden: Previously we never started in the hidden state and all was well. But with archived rooms you DO want to start hidden as you haven't fetched the room list yet. Without this, you need to click twice (close/open) before the archived room list will load. showSpinner: If true, will show a spinner iff there are 0 elements being displayed. Used when fetching the archived room list in RoomList. --- src/components/structures/RoomSubList.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomSubList.js b/src/components/structures/RoomSubList.js index b71d32851..7ebedbe19 100644 --- a/src/components/structures/RoomSubList.js +++ b/src/components/structures/RoomSubList.js @@ -64,6 +64,8 @@ var RoomSubList = React.createClass({ bottommost: React.PropTypes.bool, selectedRoom: React.PropTypes.string.isRequired, activityMap: React.PropTypes.object.isRequired, + startAsHidden: React.PropTypes.bool, + showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded // TODO: Fix the name of this. This is too easily confused with the // "hidden" state which is the expanded (or not) view of the list of rooms. @@ -76,7 +78,7 @@ var RoomSubList = React.createClass({ getInitialState: function() { return { - hidden: false, + hidden: this.props.startAsHidden || false, sortedList: [], }; }, @@ -307,9 +309,11 @@ var RoomSubList = React.createClass({ ); } else { + var Loader = sdk.getComponent("elements.Spinner"); return (
{ this.props.alwaysShowHeader ? this._getHeaderJsx() : undefined } + { (this.props.showSpinner && !this.state.hidden) ? : undefined }
); }