From 79299891fd4c1afb20d1faa1bf397c14e353e942 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 22 Jul 2024 15:24:49 +0200 Subject: [PATCH 1/2] Detect cycles when looking for predecessor rooms --- src/client.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client.ts b/src/client.ts index 32ce1b26850..d7d4f08f16a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5401,10 +5401,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)) return ret; + seenRoomIDs.add(predecessorRoomId); + } const predecessorRoom = this.getRoom(predecessorRoomId); if (predecessorRoom === null) { break; From e0ef467d7d2f223fde4d8203287779efd6425d03 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 29 Jul 2024 13:55:08 +0100 Subject: [PATCH 2/2] break instead of return --- src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index d7d4f08f16a..8e4609607ab 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5407,7 +5407,7 @@ export class MatrixClient extends TypedEventEmitter