mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[kbnUrl] clarify the purpose _shouldAutoReload
This commit is contained in:
parent
a7304ec425
commit
fbfbae3926
1 changed files with 5 additions and 5 deletions
|
@ -165,7 +165,7 @@ function KbnUrlProvider($injector, $location, $rootScope, $parse, Private) {
|
|||
if ($injector.has('$route')) {
|
||||
const $route = $injector.get('$route');
|
||||
|
||||
if (self._shouldAutoReload(next, prev, $route)) {
|
||||
if (self._shouldForceReload(next, prev, $route)) {
|
||||
const appState = Private(AppStateProvider).getAppState();
|
||||
if (appState) appState.destroy();
|
||||
|
||||
|
@ -180,21 +180,21 @@ function KbnUrlProvider($injector, $location, $rootScope, $parse, Private) {
|
|||
}
|
||||
};
|
||||
|
||||
self._shouldAutoReload = function (next, prev, $route) {
|
||||
// determine if the router will automatically reload the route
|
||||
self._shouldForceReload = function (next, prev, $route) {
|
||||
if (reloading) return false;
|
||||
|
||||
let route = $route.current && $route.current.$$route;
|
||||
if (!route) return false;
|
||||
|
||||
// for the purposes of determining wether there will be a reload,
|
||||
// '' and '/' are equal
|
||||
// for the purposes of determining whether the router will
|
||||
// automatically be reloading, '' and '/' are equal
|
||||
const nextPath = next.path || '/';
|
||||
const prevPath = prev.path || '/';
|
||||
if (nextPath !== prevPath) return false;
|
||||
|
||||
let reloadOnSearch = route.reloadOnSearch;
|
||||
let searchSame = _.isEqual(next.search, prev.search);
|
||||
|
||||
return (reloadOnSearch && searchSame) || !reloadOnSearch;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue