From 2ef934c39dd9a26b029eb8c1797c9804d34217b0 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 15 May 2023 22:05:24 +0530 Subject: [PATCH] Resolve promise on all code paths --- src/matrix/room/BaseRoom.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/BaseRoom.js b/src/matrix/room/BaseRoom.js index 85489832..2acc8435 100644 --- a/src/matrix/room/BaseRoom.js +++ b/src/matrix/room/BaseRoom.js @@ -562,6 +562,7 @@ export class BaseRoom extends EventEmitter { * We only return the timeline when it has completely loaded! */ log.log({ l: "Returning existing timeline" }); + resolve(); return this._timeline; } this._timeline = new Timeline({ @@ -585,11 +586,12 @@ export class BaseRoom extends EventEmitter { this._timeline.enableEncryption(this._decryptEntries.bind(this, DecryptionSource.Timeline)); } await this._timeline.load(this._user, this.membership, log); - resolve(); } catch (err) { // this also clears this._timeline in the closeCallback this._timeline.dispose(); throw err; + } finally { + resolve(); } return this._timeline; });