Bug 1624308 - Select top-level context if selected context is removed from the context list. r=jlast.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 23 Mar 2020 20:34:52 +0000
changeset 520183 65e34e9a513ba5daaa0571cde510b4f018dcde11
parent 520182 5495c9c742d97436b2766f0026805219f076de6e
child 520184 a76dbda5d45aa99fb209a0b79226fa5df193f25d
push id37245
push useropoprus@mozilla.com
push dateTue, 24 Mar 2020 21:46:41 +0000
treeherdermozilla-central@dbabf2e388fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1624308
milestone76.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 1624308 - Select top-level context if selected context is removed from the context list. r=jlast. Differential Revision: https://phabricator.services.mozilla.com/D67865
devtools/client/framework/reducers/threads.js
--- a/devtools/client/framework/reducers/threads.js
+++ b/devtools/client/framework/reducers/threads.js
@@ -29,17 +29,23 @@ function threadsReducer(state = initialR
         ...state,
         threads: [...state.threads, action.thread],
       };
     }
     case "CLEAR_THREAD": {
       const threads = state.threads.filter(
         thread => thread._targetFront !== action.target
       );
-      return { ...state, threads };
+
+      let { selected } = state;
+      if (selected._targetFront === action.target) {
+        selected = null;
+      }
+
+      return { ...state, threads, selected };
     }
   }
   return state;
 }
 
 exports.getToolboxThreads = getToolboxThreads;
 function getToolboxThreads(state) {
   return state.threads.threads;