narrow: Call reset_ui_state at start of narrowing process.

Continuing the efforts to reduce dom trashing from the previous
commits, here we remove the third forced reflow by reordering the call
to $(".top-messages-logo").show() via narrow.reset_ui_state(), such
that it happens before the other DOM writes in
recent_topics_ui.hide().

Tweaked by tabbott to avoid adding an unnecessary if/else statement
around recent_topics_ui.hide.
This commit is contained in:
YashRE42 2021-11-26 19:43:59 +05:30 committed by Tim Abbott
parent d466627fe2
commit 089fdc4d94
2 changed files with 3 additions and 3 deletions

View File

@ -192,10 +192,10 @@ run_test("basics", () => {
assert.equal(narrow_state.narrowed_to_pms(), false); assert.equal(narrow_state.narrowed_to_pms(), false);
helper.assert_events([ helper.assert_events([
[notifications, "clear_compose_notifications"],
[notifications, "redraw_title"],
[message_scroll, "hide_top_of_narrow_notices"], [message_scroll, "hide_top_of_narrow_notices"],
[message_scroll, "hide_indicators"], [message_scroll, "hide_indicators"],
[notifications, "clear_compose_notifications"],
[notifications, "redraw_title"],
[ui_util, "change_tab_to"], [ui_util, "change_tab_to"],
[unread_ops, "process_visible"], [unread_ops, "process_visible"],
[hashchange, "save_narrow"], [hashchange, "save_narrow"],

View File

@ -197,6 +197,7 @@ export function activate(raw_operators, opts) {
const start_time = new Date(); const start_time = new Date();
reset_ui_state();
if (recent_topics_util.is_visible()) { if (recent_topics_util.is_visible()) {
recent_topics_ui.hide(); recent_topics_ui.hide();
} }
@ -218,7 +219,6 @@ export function activate(raw_operators, opts) {
const operators = filter.operators(); const operators = filter.operators();
update_narrow_title(filter); update_narrow_title(filter);
reset_ui_state();
blueslip.debug("Narrowed", { blueslip.debug("Narrowed", {
operators: operators.map((e) => e.operator), operators: operators.map((e) => e.operator),