Resolve promise on all code paths

This commit is contained in:
RMidhunSuresh 2023-05-15 22:05:24 +05:30
parent 4bed52aa58
commit 2ef934c39d

View File

@ -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;
});