Skip to content

Commit

Permalink
Fix double fetch errors (#54701)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Jan 16, 2020
1 parent 3419b06 commit c8c03e4
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -826,9 +826,14 @@ function discoverController(
};

$scope.updateQueryAndFetch = function({ query, dateRange }) {
const oldDateRange = timefilter.getTime();
timefilter.setTime(dateRange);
$state.query = query;
$scope.fetch();
// storing the updated timerange in the state will trigger a fetch
// call automatically, so only trigger fetch in case this is a refresh call (no changes in parameters).
if (_.isEqual(oldDateRange, dateRange)) {
$scope.fetch();
}
};

function onResults(resp) {
Expand Down

0 comments on commit c8c03e4

Please sign in to comment.