Fixes to ensure account data values do not go stale (#9331)
* Fixes to ensure account data values do not go stale * Remove unneeded cli.off * fix test
This commit is contained in:
parent
3c5ff30177
commit
3e076c8246
3 changed files with 58 additions and 2 deletions
|
@ -401,6 +401,8 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private get cli(): MatrixClient { return MatrixClientPeg.get(); }
|
||||
|
||||
public componentDidMount(): void {
|
||||
window.addEventListener("resize", this.onWindowResized);
|
||||
}
|
||||
|
@ -1258,8 +1260,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
this.themeWatcher.recheck();
|
||||
StorageManager.tryPersistStorage();
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
createLocalNotificationSettingsIfNeeded(cli);
|
||||
this.cli.on(ClientEvent.Sync, this.onInitialSync);
|
||||
|
||||
if (
|
||||
MatrixClientPeg.currentUserIsJustRegistered() &&
|
||||
|
@ -1287,6 +1288,14 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
}
|
||||
|
||||
private onInitialSync = (): void => {
|
||||
if (this.cli.isInitialSyncComplete()) {
|
||||
this.cli.off(ClientEvent.Sync, this.onInitialSync);
|
||||
}
|
||||
|
||||
createLocalNotificationSettingsIfNeeded(this.cli);
|
||||
};
|
||||
|
||||
private async onShowPostLoginScreen(useCase?: UseCase) {
|
||||
if (useCase) {
|
||||
PosthogAnalytics.instance.setProperty("ftueUseCaseSelection", useCase);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue