Skip to content

Commit 4d9d4dd

Browse files
committed
Proper clearing of remote workspace when exiting
1 parent ee69be9 commit 4d9d4dd

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎renderer/components/mainPages/connectionModal.jsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,14 @@ const ConnectionModal = ({ visible, closable, onClose, onConnect }) =>{
18711871
workingDirectory: "",
18721872
isRemote: false
18731873
})
1874+
// Stop mongo tunnel but ignore errors (in case it was started outside of this workflow or already stopped)
1875+
try {
1876+
await ipcRenderer.invoke('stopPortTunnel', { name: 'mongo' })
1877+
} catch (e) {
1878+
console.warn('Failed to stop mongo tunnel:', e)
1879+
}
18741880
} catch (e) {
1875-
// ignore stop failures
1881+
console.warn('Error leaving workspace:', e)
18761882
}
18771883
finally {
18781884
setConnectionProcessing(false)

‎renderer/pages/_app.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ function App() {
266266
if (workspaceObject.hasBeenSet == true) {
267267
console.log("workspaceObject changed", workspaceObject)
268268
getGlobalData()
269+
} else {
270+
console.log("Clearing global data because workspaceObject has not been set yet", workspaceObject)
271+
setGlobalData({})
269272
}
270273
}, [workspaceObject])
271274

0 commit comments

Comments
 (0)