Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] fix back button issue when navigating between dashboards via drilldown #60547

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 4 additions & 6 deletions src/legacy/ui/public/chrome/api/sub_url_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

import url from 'url';

import { unhashUrl } from '../../../../../plugins/kibana_utils/public';
import { toastNotifications } from '../../notify/toasts';
import { npSetup } from '../../new_platform';
Expand Down Expand Up @@ -47,14 +45,14 @@ export function registerSubUrlHooks(angularModule, internals) {
}

$rootScope.$on('$locationChangeStart', (e, newUrl) => {
const getHash = url => url.split('#')[1] || '';

// This handler fixes issue #31238 where browser back navigation
// fails due to angular 1.6 parsing url encoded params wrong.
const parsedAbsUrl = url.parse($location.absUrl());
const absUrlHash = parsedAbsUrl.hash ? parsedAbsUrl.hash.slice(1) : '';
const absUrlHash = getHash($location.absUrl());
const decodedAbsUrlHash = decodeURIComponent(absUrlHash);

const parsedNewUrl = url.parse(newUrl);
const newHash = parsedNewUrl.hash ? parsedNewUrl.hash.slice(1) : '';
const newHash = getHash(newUrl);
const decodedHash = decodeURIComponent(newHash);

if (absUrlHash !== newHash && decodedHash === decodedAbsUrlHash) {
Expand Down