diff --git a/src/ui/public/fixed_scroll.js b/src/ui/public/fixed_scroll.js index 09963b82870c0..0eda343b37e51 100644 --- a/src/ui/public/fixed_scroll.js +++ b/src/ui/public/fixed_scroll.js @@ -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; }); }