Skip to content

Commit

Permalink
[Discover] Remove redundant execution of onRequestStart when fetching…
Browse files Browse the repository at this point in the history
… data (#94093)
  • Loading branch information
kertal authored Mar 16, 2021
1 parent 067543b commit d71e1b4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/plugins/discover/public/application/angular/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,13 @@ function discoverController($route, $scope, Promise) {

async function setupVisualization() {
// If no timefield has been specified we don't create a histogram of messages
if (!getTimeField() || $scope.state.hideChart) return;
if (!getTimeField() || $scope.state.hideChart) {
if ($scope.volatileSearchSource.getField('aggs')) {
// cleanup aggs field in case it was set before
$scope.volatileSearchSource.removeField('aggs');
}
return;
}
const { interval: histogramInterval } = $scope.state;

const visStateAggs = [
Expand All @@ -723,11 +729,6 @@ function discoverController($route, $scope, Promise) {
visStateAggs
);

$scope.volatileSearchSource.onRequestStart((searchSource, options) => {
if (!$scope.opts.chartAggConfigs) return;
return $scope.opts.chartAggConfigs.onSearchRequestStart(searchSource, options);
});

$scope.volatileSearchSource.setField('aggs', function () {
if (!$scope.opts.chartAggConfigs) return;
return $scope.opts.chartAggConfigs.toDsl();
Expand Down

0 comments on commit d71e1b4

Please sign in to comment.