Skip to content

Commit 7cc1573

Browse files
committed
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.
1 parent f7c4cca commit 7cc1573

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/components/structures/RoomSubList.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ var RoomSubList = React.createClass({
6464
bottommost: React.PropTypes.bool,
6565
selectedRoom: React.PropTypes.string.isRequired,
6666
activityMap: React.PropTypes.object.isRequired,
67+
startAsHidden: React.PropTypes.bool,
68+
showSpinner: React.PropTypes.bool, // true to show a spinner if 0 elements when expanded
6769

6870
// TODO: Fix the name of this. This is too easily confused with the
6971
// "hidden" state which is the expanded (or not) view of the list of rooms.
@@ -76,7 +78,7 @@ var RoomSubList = React.createClass({
7678

7779
getInitialState: function() {
7880
return {
79-
hidden: false,
81+
hidden: this.props.startAsHidden || false,
8082
sortedList: [],
8183
};
8284
},
@@ -307,9 +309,11 @@ var RoomSubList = React.createClass({
307309
);
308310
}
309311
else {
312+
var Loader = sdk.getComponent("elements.Spinner");
310313
return (
311314
<div className="mx_RoomSubList">
312315
{ this.props.alwaysShowHeader ? this._getHeaderJsx() : undefined }
316+
{ (this.props.showSpinner && !this.state.hidden) ? <Loader /> : undefined }
313317
</div>
314318
);
315319
}

0 commit comments

Comments
 (0)