Bug 1498103: Use existing USB runtime to keep current state. r=jdescottes
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Wed, 24 Oct 2018 06:07:15 +0000
changeset 491071 8523f4a3ba87384698b64cb8bb0c6e3303952f9a
parent 491070 eca6ed1ae9ad1ef7a3c347741b1c85a948c61048
child 491072 819df51e30836ba46efe72d91654a3c6b9365f02
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersjdescottes
bugs1498103
milestone65.0a1
Bug 1498103: Use existing USB runtime to keep current state. r=jdescottes So far, when USB list was updated, since we replace to all new instances, the states had not been able to keep. To resolve this, re-use runtimes that retain in runtimes state. Depends on D9470 Differential Revision: https://phabricator.services.mozilla.com/D9471
devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js
--- a/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js
+++ b/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js
@@ -106,23 +106,28 @@ function runtimesReducer(state = Runtime
       const runtimeDetails =
         Object.assign({}, runtime.runtimeDetails, { connectionPromptEnabled });
       return _updateRuntimeById(runtimeId, { runtimeDetails }, state);
     }
 
     case USB_RUNTIMES_UPDATED: {
       const { runtimes } = action;
       const usbRuntimes = runtimes.map(runtime => {
+        const existingRuntime = findRuntimeById(runtime.id, state);
+        const existingRuntimeDetails =
+          existingRuntime ? existingRuntime.runtimeDetails : null;
+
         return {
           id: runtime.id,
           extra: {
             connectionParameters: { socketPath: runtime._socketPath },
             deviceName: runtime.deviceName,
           },
           name: runtime.shortName,
+          runtimeDetails: existingRuntimeDetails,
           type: RUNTIMES.USB,
         };
       });
       return Object.assign({}, state, { usbRuntimes });
     }
 
     case WATCH_RUNTIME_SUCCESS: {
       const { id } = action.runtime;