Add UserProfilesStore, LruCache and cache for user permalink profiles (#10425)

This commit is contained in:
Michael Weimann 2023-03-27 10:07:43 +02:00 committed by GitHub
parent 1c039fcd38
commit aec454dd6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 925 additions and 55 deletions

View file

@ -28,6 +28,7 @@ import RightPanelStore from "../stores/right-panel/RightPanelStore";
import { RoomViewStore } from "../stores/RoomViewStore";
import SpaceStore, { SpaceStoreClass } from "../stores/spaces/SpaceStore";
import TypingStore from "../stores/TypingStore";
import { UserProfilesStore } from "../stores/UserProfilesStore";
import { WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
import { WidgetPermissionStore } from "../stores/widgets/WidgetPermissionStore";
import WidgetStore from "../stores/WidgetStore";
@ -75,6 +76,7 @@ export class SdkContextClass {
protected _VoiceBroadcastPreRecordingStore?: VoiceBroadcastPreRecordingStore;
protected _VoiceBroadcastPlaybacksStore?: VoiceBroadcastPlaybacksStore;
protected _AccountPasswordStore?: AccountPasswordStore;
protected _UserProfilesStore?: UserProfilesStore;
/**
* Automatically construct stores which need to be created eagerly so they can register with
@ -185,4 +187,20 @@ export class SdkContextClass {
}
return this._AccountPasswordStore;
}
public get userProfilesStore(): UserProfilesStore {
if (!this.client) {
throw new Error("Unable to create UserProfilesStore without a client");
}
if (!this._UserProfilesStore) {
this._UserProfilesStore = new UserProfilesStore(this.client);
}
return this._UserProfilesStore;
}
public onLoggedOut(): void {
this._UserProfilesStore = undefined;
}
}