Fix double fetch errors (#54701)

This commit is contained in:
Joe Reuter 2020-01-16 15:41:29 +01:00 committed by GitHub
parent 3419b06ee3
commit c8c03e4e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {