From 99da0ef656131d38668fc59b611b5d01693df971 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 22 Jan 2016 16:11:09 +0000 Subject: [PATCH] Fix vector-im/vector-web#694 - Empty invitee list The invitee list is lazy-loaded 50ms after the first render. We were relying on setState from the member lazy-load to also kick the invitee list. However, setState is synchronous and we were loading the invitee list afterwards, which meant that the SearchableEntityList wouldn't have any invitees until the next render(). --- src/components/views/rooms/MemberList.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 3af4cdc44f..16ecad8885 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -69,11 +69,13 @@ module.exports = React.createClass({ // Lazy-load in more than the first N members setTimeout(function() { if (!self.isMounted()) return; + // lazy load to prevent it blocking the first render + self._loadUserList(); + self.setState({ members: self.roomMembers() }); - // lazy load to prevent it blocking the first render - self._loadUserList(); + }, 50); // Attach a SINGLE listener for global presence changes then locate the