Skip to content

Commit 7308ed0

Browse files
committed
Fix reloading of index pattern
1 parent 190c03a commit 7308ed0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/plugins/discover/public/application/angular/discover.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
264264
if (!_.isEqual(newStatePartial, oldStatePartial)) {
265265
$scope.$evalAsync(async () => {
266266
if (oldStatePartial.index !== newStatePartial.index) {
267-
//in case of index switch the route has currently to be reloaded, legacy
267+
//in case of index pattern switch the route has currently to be reloaded, legacy
268+
$route.reload();
268269
return;
269270
}
270271

@@ -302,7 +303,6 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
302303
config.get(MODIFY_COLUMNS_ON_SWITCH)
303304
);
304305
await setAppState(nextAppState);
305-
$route.reload();
306306
}
307307
};
308308

test/functional/apps/discover/_indexpattern_without_timefield.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
5151
throw new Error('Expected timepicker to exist');
5252
}
5353
});
54-
it('should not display a timepicker after using history.back()', async () => {
54+
it('should switch between with and without timefield using the browser back button', async () => {
55+
await PageObjects.discover.selectIndexPattern('without-timefield');
56+
if (await PageObjects.timePicker.timePickerExists()) {
57+
throw new Error('Expected timepicker not to exist');
58+
}
59+
60+
await PageObjects.discover.selectIndexPattern('with-timefield');
61+
if (!(await PageObjects.timePicker.timePickerExists())) {
62+
throw new Error('Expected timepicker to exist');
63+
}
5564
// Navigating back to discover
5665
await browser.goBack();
5766
if (await PageObjects.timePicker.timePickerExists()) {

0 commit comments

Comments
 (0)