Skip to content

Commit 25d6675

Browse files
authored
fix: clear cached driver instance after detaching (#2753)
1 parent 69a01a4 commit 25d6675

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/common/renderer/actions/SessionInspector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ export function quitSession({reason, manualQuit = true, detachOnly = false} = {}
308308
await applyAction(dispatch, getState);
309309
}
310310
dispatch({type: QUIT_SESSION_DONE});
311+
InspectorDriver.clearInstance(); // clear the 'cached' driver instance
311312
if (!manualQuit) {
312313
showError(new Error(reason || i18n.t('Session has been terminated')), {secs: 0});
313314
}

app/common/renderer/lib/appium/inspector-driver.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ export default class InspectorDriver {
4242
return _instance;
4343
}
4444

45+
static clearInstance() {
46+
_instance = null;
47+
}
48+
4549
constructor(driver) {
4650
this.driver = driver;
4751
this.elementCache = {};
@@ -67,10 +71,7 @@ export default class InspectorDriver {
6771
await this.driver.deleteSession();
6872
} catch {}
6973

70-
_instance = null;
71-
72-
// when we've quit the session, there's no source/screenshot to send
73-
// back
74+
// when we've quit the session, there's no source/screenshot to send back
7475
return {
7576
source: null,
7677
screenshot: null,

0 commit comments

Comments
 (0)