From 068de86fd5a5a5696f6986ac4471c3bbcc403184 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 2 Apr 2013 06:44:31 -0700 Subject: [PATCH] Prevent double-load of Conpherence threads Summary: We may execute the Conpherence behavior before the initial device change, in which case we'll get a desktop -> desktop device event. This currently causes us to double-load the thread list. Instead, don't do anything if the device is the same as our current understanding of device state. Test Plan: No double thread list in profiler. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D5525 --- src/__celerity_resource_map__.php | 2 +- webroot/rsrc/js/application/conpherence/behavior-menu.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 2cc5c25eec..f2cb99be7f 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1253,7 +1253,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-conpherence-menu' => array( - 'uri' => '/res/08fcd75a/rsrc/js/application/conpherence/behavior-menu.js', + 'uri' => '/res/35811cd4/rsrc/js/application/conpherence/behavior-menu.js', 'type' => 'js', 'requires' => array( diff --git a/webroot/rsrc/js/application/conpherence/behavior-menu.js b/webroot/rsrc/js/application/conpherence/behavior-menu.js index 99d46f2628..7feff51285 100644 --- a/webroot/rsrc/js/application/conpherence/behavior-menu.js +++ b/webroot/rsrc/js/application/conpherence/behavior-menu.js @@ -163,8 +163,15 @@ JX.behavior('conpherence-menu', function(config) { // select or load any threads. On Desktop, we automatically select the first // thread. + var old_device = null; function ondevicechange() { - if (JX.Device.getDevice() != 'desktop') { + var new_device = JX.Device.getDevice(); + if (new_device === old_device) { + return; + } + old_device = new_device; + + if (new_device != 'desktop') { return; }