diff --git a/src/stores/spaces/SpaceStore.ts b/src/stores/spaces/SpaceStore.ts index 5cea148b780..83e6ae07add 100644 --- a/src/stores/spaces/SpaceStore.ts +++ b/src/stores/spaces/SpaceStore.ts @@ -748,9 +748,9 @@ export class SpaceStoreClass extends AsyncStoreWithClient { } }; - 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>(lastContent, content);