From 882dc920c3dba7da2c301d13fc6a99aea6137a5c Mon Sep 17 00:00:00 2001 From: R Midhun Suresh Date: Sat, 11 Nov 2023 12:50:36 +0530 Subject: [PATCH] Ensure `setUserCreator` is called when a store is assigned (#3867) * Add method to set store * Use not null assertion * Use getter/setter * No need for check if we use setter --- src/client.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index 7a1d997cc00..542f185159b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1217,7 +1217,7 @@ export class MatrixClient extends TypedEventEmitter(this); public olmVersion: [number, number, number] | null = null; // populated after initCrypto public usingExternalCrypto = false; - public store: Store; + private _store!: Store; public deviceId: string | null; public credentials: { userId: string | null }; @@ -1332,7 +1332,6 @@ export class MatrixClient extends TypedEventEmitter User.createUser(userId, this)); this.deviceId = opts.deviceId || null; this.sessionId = randomString(10); @@ -1497,6 +1496,15 @@ export class MatrixClient extends TypedEventEmitter User.createUser(userId, this)); + } + + public get store(): Store { + return this._store; + } + /** * High level helper method to begin syncing and poll for new events. To listen for these * events, add a listener for {@link ClientEvent.Event}