Bug 1503914 - Stop disconnecting all devices when clicking on Refresh Devices;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 14 Nov 2018 03:44:00 +0000
changeset 446557 b97a83e789c28e4d10c67ce92d79a262d225caf5
parent 446556 235c2ef758a1e21f0520c5fed9cc3d4564f56c57
child 446558 85d893b168424ecc49fe597c45fd89dd53b8925f
push id35043
push userebalazs@mozilla.com
push dateThu, 15 Nov 2018 16:12:36 +0000
treeherdermozilla-central@59026ada59bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1503914
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1503914 - Stop disconnecting all devices when clicking on Refresh Devices;r=daisuke Depends on D11663 Differential Revision: https://phabricator.services.mozilla.com/D11798
devtools/client/aboutdebugging-new/src/actions/runtimes.js
--- a/devtools/client/aboutdebugging-new/src/actions/runtimes.js
+++ b/devtools/client/aboutdebugging-new/src/actions/runtimes.js
@@ -208,18 +208,20 @@ function updateUSBRuntimes(runtimes) {
       // The reason why we call selectPage before USB_RUNTIMES_UPDATED was fired is below.
       // Current runtime can not be retrieved after USB_RUNTIMES_UPDATED action, since
       // that updates runtime state. So, before that we fire selectPage action so that to
       // transact unwatchRuntime correctly.
       await dispatch(Actions.selectPage(RUNTIMES.THIS_FIREFOX, RUNTIMES.THIS_FIREFOX));
     }
 
     // Disconnect runtimes that were no longer valid
-    const invalidRuntimes =
-      getState().runtimes.usbRuntimes.filter(r => !runtimes.includes(r));
+    const validIds = runtimes.map(r => r.id);
+    const existingRuntimes = getState().runtimes.usbRuntimes;
+    const invalidRuntimes = existingRuntimes.filter(r => !validIds.includes(r.id));
+
     for (const invalidRuntime of invalidRuntimes) {
       await dispatch(disconnectRuntime(invalidRuntime.id));
     }
 
     dispatch({ type: USB_RUNTIMES_UPDATED, runtimes });
   };
 }