Remove a factor n complexity during room visibility calc

pull/21833/head
lukebarnard 2018-02-06 09:55:58 +00:00
parent c665c1170b
commit feca1707f1
1 changed files with 9 additions and 3 deletions

View File

@ -352,6 +352,14 @@ module.exports = React.createClass({
const filteredLists = {}; const filteredLists = {};
const isRoomVisible = {
// $roomId: true,
};
this._visibleRooms.forEach((r) => {
isRoomVisible[r.roomId] = true;
});
Object.keys(lists).forEach((tagName) => { Object.keys(lists).forEach((tagName) => {
filteredLists[tagName] = lists[tagName].filter((taggedRoom) => { filteredLists[tagName] = lists[tagName].filter((taggedRoom) => {
// Somewhat impossible, but guard against it anyway // Somewhat impossible, but guard against it anyway
@ -363,9 +371,7 @@ module.exports = React.createClass({
return; return;
} }
return this._visibleRooms.some((visibleRoom) => { return isRoomVisible[taggedRoom.roomId];
return visibleRoom.roomId === taggedRoom.roomId;
});
}); });
}); });