Skip to content

Commit

Permalink
defer setFilters and removeAll in dashboard controller - temp hack
Browse files Browse the repository at this point in the history
  • Loading branch information
Liza K committed Oct 10, 2019
1 parent b9cc06d commit 29dee88
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ export class DashboardAppController {
$scope.onClearSavedQuery = () => {
delete $scope.savedQuery;
dashboardStateManager.setSavedQueryId(undefined);
queryFilter.removeAll();
dashboardStateManager.applyFilters(
{
query: '',
Expand All @@ -462,10 +461,12 @@ export class DashboardAppController {
},
[]
);
// Making this method sync broke the updates.
// Temporary fix, until we fix the complex state in this file.
setTimeout(queryFilter.removeAll, 0);
};

const updateStateFromSavedQuery = (savedQuery: SavedQuery) => {
queryFilter.setFilters(savedQuery.attributes.filters || []);
dashboardStateManager.applyFilters(
savedQuery.attributes.query,
savedQuery.attributes.filters || []
Expand All @@ -479,6 +480,11 @@ export class DashboardAppController {
timefilter.setRefreshInterval(savedQuery.attributes.timefilter.refreshInterval);
}
}
// Making this method sync broke the updates.
// Temporary fix, until we fix the complex state in this file.
setTimeout(() => {
queryFilter.setFilters(savedQuery.attributes.filters || []);
}, 0);
};

$scope.$watch('savedQuery', (newSavedQuery: SavedQuery) => {
Expand Down

0 comments on commit 29dee88

Please sign in to comment.