From 66af2da9ed7be66d426d5a165d50f3b41e3f048d Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Thu, 10 Jan 2013 14:12:39 -0500 Subject: [PATCH] Cause update_floating_recipient_bar to get called less frequently. Putting update_floating_recipient_bar in the old location caused it to be called on every single keypress, which is unnecessarily expensive. Instead, just call it once when we think we might actually need it: after initiating a narrow. (imported from commit a6c1518c4001a2dde44d7b512236795da3ccd351) --- zephyr/static/js/narrow.js | 4 ++++ zephyr/static/js/zephyr.js | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/zephyr/static/js/narrow.js b/zephyr/static/js/narrow.js index c3279c4e47..85ae17f07e 100644 --- a/zephyr/static/js/narrow.js +++ b/zephyr/static/js/narrow.js @@ -228,6 +228,10 @@ exports.activate = function (operators, opts) { hashchange.save_narrow(operators); $('#search_query').val(unparse(operators)); search.update_button_visibility(); + // For good measure, redraw the floating recipient bar + // (if the page didn't scroll in achieving this narrow, + // it might still read the wrong thing.) + ui.update_floating_recipient_bar(); }; // Activate narrowing with a single operator. diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index acc73ca9cd..574606d5d0 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -189,7 +189,6 @@ function select_message(next_message, opts) { if (opts.then_scroll) { recenter_view(next_message); - ui.update_floating_recipient_bar(); } return true;