Skip to content

Commit

Permalink
We don't care about the timeline (just fire and forget)
Browse files Browse the repository at this point in the history
Split out from #2521

Context: #2521 (comment)
  • Loading branch information
MadLittleMods committed Nov 4, 2022
1 parent 4a33e58 commit a8794c2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/timeline-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class TimelineWindow {
*
* @return {Promise}
*/
public load(initialEventId?: string, initialWindowSize = 20): Promise<void> {
public async load(initialEventId?: string, initialWindowSize = 20): Promise<void> {
// given an EventTimeline, find the event we were looking for, and initialise our
// fields so that the event in question is in the middle of the window.
const initFields = (timeline: Optional<EventTimeline>) => {
Expand Down Expand Up @@ -135,13 +135,14 @@ export class TimelineWindow {
// which is important to keep room-switching feeling snappy.
if (this.timelineSet.getTimelineForEvent(initialEventId)) {
initFields(this.timelineSet.getTimelineForEvent(initialEventId));
return Promise.resolve();
return;
} else if (initialEventId) {
return this.client.getEventTimeline(this.timelineSet, initialEventId)
await this.client.getEventTimeline(this.timelineSet, initialEventId)
.then(initFields);
return;
} else {
initFields(this.timelineSet.getLiveTimeline());
return Promise.resolve();
return;
}
}

Expand Down

0 comments on commit a8794c2

Please sign in to comment.