Optimize select_zephyr_by_id for the already-selected case

Saves a call to get_zephyr.

(imported from commit 9ce9f2af7e4d8eb5e3a76a3c0ddbfb7f5896a583)
This commit is contained in:
Keegan McAllister 2012-09-20 13:44:31 -04:00
parent a00227c864
commit d4985ef5f4
1 changed files with 3 additions and 0 deletions

View File

@ -306,6 +306,9 @@ function respond_to_zephyr() {
} }
function select_zephyr_by_id(zephyr_id, scroll_to) { function select_zephyr_by_id(zephyr_id, scroll_to) {
if (zephyr_id === selected_zephyr_id) {
return;
}
select_zephyr(get_zephyr(zephyr_id), scroll_to); select_zephyr(get_zephyr(zephyr_id), scroll_to);
} }