Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ export class DashboardAppController {
$scope.savedQuery = undefined;
return;
}
if ($scope.savedQuery && newSavedQueryId !== $scope.savedQuery.id) {
if (!$scope.savedQuery || newSavedQueryId !== $scope.savedQuery.id) {
savedQueryService.getSavedQuery(newSavedQueryId).then((savedQuery: SavedQuery) => {
$scope.$evalAsync(() => {
$scope.savedQuery = savedQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ function discoverController(
$scope.minimumVisibleRows = 50;
$scope.fetchStatus = fetchStatuses.UNINITIALIZED;
$scope.refreshInterval = timefilter.getRefreshInterval();
$scope.savedQuery = $route.current.locals.savedQuery;
$scope.showSaveQuery = uiCapabilities.discover.saveQuery;

$scope.$watch(() => uiCapabilities.discover.saveQuery, (newCapability) => {
Expand Down Expand Up @@ -548,6 +547,11 @@ function discoverController(
};

const shouldSearchOnPageLoad = () => {
// If a saved query is referenced in the app state, omit the initial load because the saved query will
// be fetched separately and trigger a reload
if ($scope.state.savedQuery) {
return false;
}
// A saved search is created on every page load, so we check the ID to see if we're loading a
// previously saved search or if it is just transient
return config.get('discover:searchOnPageLoad')
Expand Down Expand Up @@ -979,7 +983,7 @@ function discoverController(
return;
}

if ($scope.savedQuery && newSavedQueryId !== $scope.savedQuery.id) {
if (!$scope.savedQuery || newSavedQueryId !== $scope.savedQuery.id) {
savedQueryService.getSavedQuery(newSavedQueryId).then((savedQuery) => {
$scope.$evalAsync(() => {
$scope.savedQuery = savedQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ function VisEditor(
$scope.savedQuery = undefined;
return;
}
if ($scope.savedQuery && newSavedQueryId !== $scope.savedQuery.id) {
if (!$scope.savedQuery || newSavedQueryId !== $scope.savedQuery.id) {
savedQueryService.getSavedQuery(newSavedQueryId).then((savedQuery) => {
$scope.$evalAsync(() => {
$scope.savedQuery = savedQuery;
Expand Down