Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6a002b1

Browse files
committed
re-enable promise short-circuiting
1 parent 16cb4e6 commit 6a002b1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/components/structures/TimelinePanel.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,18 @@ class TimelinePanel extends React.Component<IProps, IState> {
14091409
// quite slow. So we detect that situation and shortcut straight to
14101410
// calling _reloadEvents and updating the state.
14111411

1412+
// This is a hot-path optimization by skipping a promise tick
1413+
// by repeating a no-op sync branch in
1414+
// TimelineSet.getTimelineForEvent & MatrixClient.getEventTimeline
1415+
if (this.props.timelineSet.getTimelineForEvent(eventId)) {
1416+
// if we've got an eventId, and the timeline exists, we can skip
1417+
// the promise tick.
1418+
this.timelineWindow.load(eventId, INITIAL_SIZE);
1419+
// in this branch this method will happen in sync time
1420+
onLoaded();
1421+
return;
1422+
}
1423+
14121424
const prom = this.timelineWindow.load(eventId, INITIAL_SIZE);
14131425
this.buildLegacyCallEventGroupers();
14141426
this.setState({

0 commit comments

Comments
 (0)