diff --git a/src/client.ts b/src/client.ts index de0af218fbc..9da03de8ebc 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5587,10 +5587,15 @@ export class MatrixClient extends TypedEventEmitter([room.roomId]); // Work backwards from newer to older rooms let predecessorRoomId = room.findPredecessor(msc3946ProcessDynamicPredecessor)?.roomId; while (predecessorRoomId !== null) { + if (predecessorRoomId) { + if (seenRoomIDs.has(predecessorRoomId)) break; + seenRoomIDs.add(predecessorRoomId); + } const predecessorRoom = this.getRoom(predecessorRoomId); if (predecessorRoom === null) { break;