From 0dea1f9d1964f53b7b47f6b5ac31b0e6035cb5b6 Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Mon, 4 Mar 2019 17:56:52 +0100 Subject: [PATCH] Clean up connection on disconnect --- app/src/actions/Connection.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/actions/Connection.ts b/app/src/actions/Connection.ts index b3448c7..e3edc8a 100644 --- a/app/src/actions/Connection.ts +++ b/app/src/actions/Connection.ts @@ -73,7 +73,11 @@ export const connecting: (connectionId: string) => Action = (connectionId: strin export const disconnect = () => (dispatch: Dispatch, getState: () => AppState) => { const { connectionId, tree } = getState().connection - rendererEvents.emit(removeConnection, connectionId) + if (connectionId) { + rendererEvents.emit(removeConnection, connectionId) + rendererEvents.unsubscribeAll(makeConnectionStateEvent(connectionId)) + } + tree && tree.stopUpdating() dispatch(showTree(undefined))