diff --git a/src/app/molecules/room-members/RoomMembers.jsx b/src/app/molecules/room-members/RoomMembers.jsx index a1ffd21..ac004f4 100644 --- a/src/app/molecules/room-members/RoomMembers.jsx +++ b/src/app/molecules/room-members/RoomMembers.jsx @@ -58,8 +58,10 @@ function useMemberOfMembership(roomId, membership) { useEffect(() => { let isMounted = true; + let isLoadingMembers = false; const updateMemberList = (event) => { + if (isLoadingMembers) return; if (event && event?.getRoomId() !== roomId) return; const memberOfMembership = normalizeMembers( room.getMembersWithMembership(membership) @@ -69,7 +71,9 @@ function useMemberOfMembership(roomId, membership) { }; updateMemberList(); + isLoadingMembers = true; room.loadMembersIfNeeded().then(() => { + isLoadingMembers = false; if (!isMounted) return; updateMemberList(); }); diff --git a/src/app/organisms/room/PeopleDrawer.jsx b/src/app/organisms/room/PeopleDrawer.jsx index 026173d..ee96614 100644 --- a/src/app/organisms/room/PeopleDrawer.jsx +++ b/src/app/organisms/room/PeopleDrawer.jsx @@ -103,10 +103,10 @@ function PeopleDrawer({ roomId }) { }, [memberList]); useEffect(() => { - let isGettingMembers = true; + let isLoadingMembers = false; let isRoomChanged = false; const updateMemberList = (event) => { - if (isGettingMembers) return; + if (isLoadingMembers) return; if (event && event?.getRoomId() !== roomId) return; setMemberList( simplyfiMembers( @@ -117,8 +117,9 @@ function PeopleDrawer({ roomId }) { }; searchRef.current.value = ''; updateMemberList(); + isLoadingMembers = true; room.loadMembersIfNeeded().then(() => { - isGettingMembers = false; + isLoadingMembers = false; if (isRoomChanged) return; updateMemberList(); });