Guard around SpaceStore onAccountData handler prevEvent (#7123)

pull/21833/head
Michael Telatynski 2021-11-12 10:39:52 +00:00 committed by GitHub
parent 98ea2c3302
commit a16e6dab4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -748,9 +748,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
}
};
private onAccountData = (ev: MatrixEvent, lastEvent: MatrixEvent) => {
private onAccountData = (ev: MatrixEvent, prevEvent?: MatrixEvent) => {
if (!this.allRoomsInHome && ev.getType() === EventType.Direct) {
const lastContent = lastEvent.getContent();
const lastContent = prevEvent?.getContent() ?? {};
const content = ev.getContent();
const diff = objectDiff<Record<string, string[]>>(lastContent, content);