fix data not being passed on, caused crash on initial sync

This commit is contained in:
Bruno Windels 2020-09-14 17:45:13 +02:00
parent a11b612640
commit 75bff228ec
2 changed files with 4 additions and 3 deletions

View File

@ -181,7 +181,7 @@ export class Room extends EventEmitter {
// fetch new members while we have txn open, // fetch new members while we have txn open,
// but don't make any in-memory changes yet // but don't make any in-memory changes yet
let heroChanges; let heroChanges;
if (needsHeroes(summaryChanges)) { if (summaryChanges && needsHeroes(summaryChanges)) {
// room name disappeared, open heroes // room name disappeared, open heroes
if (!this._heroes) { if (!this._heroes) {
this._heroes = new Heroes(this._roomId); this._heroes = new Heroes(this._roomId);

View File

@ -52,6 +52,7 @@ function applySyncResponse(data, roomResponse, membership) {
if (typeof event.state_key === "string") { if (typeof event.state_key === "string") {
return processStateEvent(data, event); return processStateEvent(data, event);
} }
return data;
}, data); }, data);
} }
const unreadNotifications = roomResponse.unread_notifications; const unreadNotifications = roomResponse.unread_notifications;
@ -307,9 +308,9 @@ export class RoomSummary {
// clear cloned flag, so cloneIfNeeded makes a copy and // clear cloned flag, so cloneIfNeeded makes a copy and
// this._data is not modified if any field is changed. // this._data is not modified if any field is changed.
this._data.cloned = false; this._data.cloned = false;
let data = applySyncResponse(this._data, roomResponse, membership); let data = applySyncResponse(this._data, roomResponse, membership);
data = applyTimelineEntries( data = applyTimelineEntries(
this._data, data,
timelineEntries, timelineEntries,
isInitialSync, isTimelineOpen, isInitialSync, isTimelineOpen,
this._ownUserId); this._ownUserId);