From 87c9551507a06803e5809d3930052e3693e4207e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 14 Sep 2021 12:49:18 +0100 Subject: [PATCH 1/2] Fix edge cases around joining new room which does not belong to active space --- src/stores/SpaceStore.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index f49d51454b..eebc196f4c 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -629,11 +629,18 @@ export class SpaceStoreClass extends AsyncStoreWithClient { }; private onRoom = (room: Room, newMembership?: string, oldMembership?: string) => { - const membership = newMembership || room.getMyMembership(); + const roomMembership = room.getMyMembership(); + if (roomMembership === null) { + // room is still being baked in the js-sdk, we'll process it at Room.myMembership instead + return; + } + const membership = newMembership || roomMembership; if (!room.isSpaceRoom()) { // this.onRoomUpdate(room); - this.onRoomsUpdate(); + // this.onRoomsUpdate(); + // ideally we only need onRoomsUpdate here but it doesn't rebuild parentMap so always adds new rooms to Home + this.rebuild(); if (membership === "join") { // the user just joined a room, remove it from the suggested list if it was there From 919270ff0cfe739f65ec8551c592584a4b067b1a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 14 Sep 2021 15:50:51 +0100 Subject: [PATCH 2/2] Update src/stores/SpaceStore.tsx Co-authored-by: Travis Ralston --- src/stores/SpaceStore.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/SpaceStore.tsx b/src/stores/SpaceStore.tsx index eebc196f4c..cd0acc9d88 100644 --- a/src/stores/SpaceStore.tsx +++ b/src/stores/SpaceStore.tsx @@ -630,7 +630,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient { private onRoom = (room: Room, newMembership?: string, oldMembership?: string) => { const roomMembership = room.getMyMembership(); - if (roomMembership === null) { + if (!roomMembership) { // room is still being baked in the js-sdk, we'll process it at Room.myMembership instead return; }