Fix emitter leaks, style, tree swaps

This commit is contained in:
Thomas Nordquist
2019-01-22 12:17:59 +01:00
parent 221abd8c48
commit d4ce58a8ec
22 changed files with 411 additions and 164 deletions

View File

@@ -18,9 +18,17 @@ export const selectTopic = (topic: q.TreeNode) => (dispatch: Dispatch<any>, getS
})
}
export const showTree = (tree?: q.Tree) => {
return {
export const showTree = (tree?: q.Tree) => (dispatch: Dispatch<any>, getState: () => AppState) => {
const visibleTree = getState().tree.tree
const connectionTree = getState().connection.tree
// Stop updates of old tree
if (visibleTree !== connectionTree && visibleTree) {
visibleTree.stopUpdating()
}
dispatch({
tree,
type: ActionTypes.TREE_SHOW_TREE,
}
})
}