prevent another race between sync and openTimeline

This commit is contained in:
Bruno Windels 2021-06-04 16:28:08 +02:00
parent bb6905bdcd
commit 7691b28503

View file

@ -32,7 +32,8 @@ export class Timeline {
this._disposables = new Disposables();
this._pendingEvents = pendingEvents;
this._clock = clock;
this._remoteEntries = null;
// constructing this early avoid some problem while sync and openTimeline race
this._remoteEntries = new SortedArray((a, b) => a.compare(b));
this._ownMember = null;
this._timelineReader = new TimelineReader({
roomId: this._roomId,
@ -96,7 +97,6 @@ export class Timeline {
}
_setupEntries(timelineEntries) {
this._remoteEntries = new SortedArray((a, b) => a.compare(b));
this._remoteEntries.setManySorted(timelineEntries);
if (this._pendingEvents) {
this._localEntries = new MappedList(this._pendingEvents, pe => {