From 391c653d24c56465e15002d320ccba65b455a6a4 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 20 Jan 2016 14:14:04 +0000 Subject: [PATCH] Lazy-load the user list to improve perf Still slow when typing due to adding 1000 tiles to the DOM, but it is at least a lot better than before (which would stutter on ANY change to the member list) --- src/components/views/rooms/EntityTile.js | 2 +- src/components/views/rooms/MemberList.js | 20 +++++++++++-------- .../views/rooms/SearchableEntityList.js | 6 ++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/components/views/rooms/EntityTile.js b/src/components/views/rooms/EntityTile.js index a0135fb0c3..55629aa8b0 100644 --- a/src/components/views/rooms/EntityTile.js +++ b/src/components/views/rooms/EntityTile.js @@ -121,7 +121,7 @@ module.exports = React.createClass({ var MemberAvatar = sdk.getComponent('avatars.MemberAvatar'); var BaseAvatar = sdk.getComponent('avatars.BaseAvatar'); - var av = this.props.avatarJsx || ; + var av = this.props.avatarJsx || ; return (
); } else { - // TODO: Cache this calculation - var room = MatrixClientPeg.get().getRoom(this.props.roomId); - /* var allUsers = MatrixClientPeg.get().getUsers(); - // only add Users if they are not joined - allUsers = allUsers.filter(function(u) { - return !room.hasMembershipState(u.userId, "join"); - }); */ var SearchableEntityList = sdk.getComponent("rooms.SearchableEntityList"); return ( + entities={Entities.fromUsers(this.userList || [], true, this.onInvite)} /> ); } }, diff --git a/src/components/views/rooms/SearchableEntityList.js b/src/components/views/rooms/SearchableEntityList.js index 8657293478..b6232362ac 100644 --- a/src/components/views/rooms/SearchableEntityList.js +++ b/src/components/views/rooms/SearchableEntityList.js @@ -50,6 +50,12 @@ var SearchableEntityList = React.createClass({ }; }, + componentWillUnmount: function() { + // pretend the query box was blanked out else filters could still be + // applied to other components which rely on onQueryChanged. + this.props.onQueryChanged(""); + }, + /** * Public-facing method to set the input query text to the given input. * @param {string} input