diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx b/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx index 926f38ac8b552..2590ab2f1cb23 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx @@ -204,6 +204,8 @@ export class ExplorerSwimlane extends React.Component { }); this.renderSwimlane(); + + this.dragSelect.stop(); } componentDidUpdate() { @@ -211,11 +213,11 @@ export class ExplorerSwimlane extends React.Component { } componentWillUnmount() { - if (this.dragSelectSubscriber !== null) { - this.dragSelectSubscriber.unsubscribe(); - } - const element = d3.select(this.rootNode.current!); - element.html(''); + this.dragSelectSubscriber!.unsubscribe(); + // Remove selector element from DOM + this.dragSelect.selector.remove(); + // removes all mousedown event handlers + this.dragSelect.stop(true); } selectCell(cellsToSelect: any[], { laneLabels, bucketScore, times }: SelectedData) {