From 190ecbf9a4051547b185412d0e92b7ef3d601291 Mon Sep 17 00:00:00 2001 From: Fabio Gatti Date: Fri, 4 Nov 2022 02:33:16 -0500 Subject: [PATCH] fix: solved navigation to same link error --- src/core/router/history/hash.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/router/history/hash.js b/src/core/router/history/hash.js index abb060f2f..068e33143 100644 --- a/src/core/router/history/hash.js +++ b/src/core/router/history/hash.js @@ -46,6 +46,15 @@ export class HashHistory extends History { let navigating = false; on('click', e => { + let hashArray = location.hash.split('?id='); + if ( + e.target.tagName === 'A' && + hashArray.length === 2 && + e.target.text.toLowerCase().replaceAll(' ', '-') === hashArray[1] + ) { + history.pushState(null, null, hashArray[0]); + } + const el = e.target.tagName === 'A' ? e.target : e.target.parentNode; if (el && el.tagName === 'A' && !/_blank/.test(el.target)) {