From 11cc68f27685453550a27b6dcb2b92d6353e689b Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 20 Mar 2020 19:12:12 +0300 Subject: [PATCH] Fix reloading when base path --- .../public/discover/np_ready/angular/discover.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js index 99a7f106a5e958..3925fe43c86f6c 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js @@ -255,6 +255,15 @@ function discoverController( } }); + // this listener is waiting for such a path http://localhost:5601/app/kibana#/discover + // which could be set through pressing "New" button in top nav or go to "Discover" plugin from the sidebar + // to reload the page in a right way + const unlistenHistoryBasePath = history.listen(({ pathname, search, hash }) => { + if (!search && !hash && pathname === '/discover') { + $route.reload(); + } + }); + $scope.setIndexPattern = async id => { await replaceUrlAppState({ index: id }); $route.reload(); @@ -310,6 +319,7 @@ function discoverController( stopStateSync(); stopSyncingGlobalStateWithUrl(); stopSyncingQueryAppStateWithStateContainer(); + unlistenHistoryBasePath(); }); const getTopNavLinks = () => {