Clean up connection on disconnect

This commit is contained in:
Thomas Nordquist
2019-03-04 17:56:52 +01:00
parent d7be46c78e
commit 0dea1f9d19

View File

@@ -73,7 +73,11 @@ export const connecting: (connectionId: string) => Action = (connectionId: strin
export const disconnect = () => (dispatch: Dispatch<any>, getState: () => AppState) => { export const disconnect = () => (dispatch: Dispatch<any>, getState: () => AppState) => {
const { connectionId, tree } = getState().connection const { connectionId, tree } = getState().connection
rendererEvents.emit(removeConnection, connectionId) if (connectionId) {
rendererEvents.emit(removeConnection, connectionId)
rendererEvents.unsubscribeAll(makeConnectionStateEvent(connectionId))
}
tree && tree.stopUpdating() tree && tree.stopUpdating()
dispatch(showTree(undefined)) dispatch(showTree(undefined))