Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit cc23f23

Browse files
authored
Merge pull request #4881 from matrix-org/travis/room-list/enable-default
Enable the new room list by default and trigger an initial render
2 parents df05273 + 1b782ce commit cc23f23

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

src/components/views/rooms/RoomList2.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,26 @@ export default class RoomList2 extends React.Component<IProps, IState> {
166166
}
167167

168168
public componentDidMount(): void {
169-
RoomListStore.instance.on(LISTS_UPDATE_EVENT, (store: RoomListStore2) => {
170-
const newLists = store.orderedLists;
171-
console.log("new lists", newLists);
172-
173-
const layoutMap = new Map<TagID, ListLayout>();
174-
for (const tagId of Object.keys(newLists)) {
175-
layoutMap.set(tagId, new ListLayout(tagId));
176-
}
169+
RoomListStore.instance.on(LISTS_UPDATE_EVENT, this.updateLists);
170+
this.updateLists(); // trigger the first update
171+
}
177172

178-
this.setState({sublists: newLists, layouts: layoutMap});
179-
});
173+
public componentWillUnmount() {
174+
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.updateLists);
180175
}
181176

177+
private updateLists = () => {
178+
const newLists = RoomListStore.instance.orderedLists;
179+
console.log("new lists", newLists);
180+
181+
const layoutMap = new Map<TagID, ListLayout>();
182+
for (const tagId of Object.keys(newLists)) {
183+
layoutMap.set(tagId, new ListLayout(tagId));
184+
}
185+
186+
this.setState({sublists: newLists, layouts: layoutMap});
187+
};
188+
182189
private renderCommunityInvites(): React.ReactElement[] {
183190
// TODO: Put community invites in a more sensible place (not in the room list)
184191
return MatrixClientPeg.get().getGroups().filter(g => {

src/settings/Settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export const SETTINGS = {
150150
isFeature: true,
151151
displayName: _td("Use the improved room list (will refresh to apply changes)"),
152152
supportedLevels: LEVELS_FEATURE,
153-
default: false,
153+
default: true,
154154
controller: new ReloadOnChangeController(),
155155
},
156156
"feature_custom_themes": {

0 commit comments

Comments
 (0)