Skip to content

Commit

Permalink
Fix error switching index patterns in Discover
Browse files Browse the repository at this point in the history
Backports PR #9682

**Commit 1:**
Fix error switching index patterns in Discover

Needed to cleanup debounced function on scope destory.

Fixes #9681

* Original sha: f82624f
* Authored by Matthew Bargar <mbargar@gmail.com> on 2016-12-29T22:29:40Z
  • Loading branch information
elastic-jasper committed Jan 3, 2017
1 parent 4a58687 commit bba89c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ui/public/fixed_scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ uiModules
}
}

$scope.$watch(debounce(checkWidth, 100));
const debouncedCheckWidth = debounce(checkWidth, 100);
$scope.$watch(debouncedCheckWidth);

// cleanup when the scope is destroyed
$scope.$on('$destroy', function () {
cleanUp();
debouncedCheckWidth.cancel();
$scroller = $window = null;
});
}
Expand Down

0 comments on commit bba89c3

Please sign in to comment.