narrow: Don't try to save the recent_topics pre_narrow_offset.

The previous logic didn't make sense -- the scroll offset in recent
topics is not a scroll offset within a message list, so saving it was
useless at best.

However, it was actually much worse than that, because trying to save
the pre-narrow offset while in the process of navigating away from
recent topics had the side effect of forcing a reflow, which resulted
in very expensive browser rendering to no purpose.

Adding this commit to the rest of the series of commits fixing
rendering issues when leaving recent topics, this commit results in an
impressive 3.05 s decrease in the first renarrow, an ~ 300 ms decrease
in the second renarrow and an ~ 500 ms decrease in the third renarrow.

There are still further forced reflows which could be reduced in this
render path, but they seem to not be as severe.
This commit is contained in:
YashRE42 2021-11-26 21:40:07 +05:30 committed by Tim Abbott
parent c4bb181056
commit 0d117ab033
1 changed files with 6 additions and 3 deletions

View File

@ -224,6 +224,12 @@ export function activate(raw_operators, opts) {
if (recent_topics_util.is_visible()) {
recent_topics_ui.hide();
} else {
// If recent topics was not visible, then we are switching
// from another message list view. Save the scroll position in
// that message list, so that we can restore it if/when we
// later navigate back to that view.
save_pre_narrow_offset_for_reload();
}
const was_narrowed_already = narrow_state.active();
@ -298,9 +304,6 @@ export function activate(raw_operators, opts) {
const excludes_muted_topics = narrow_state.excludes_muted_topics();
// Save how far from the pointer the top of the message list was.
save_pre_narrow_offset_for_reload();
let msg_data = new MessageListData({
filter: narrow_state.filter(),
excludes_muted_topics,