Skip to content

Commit 0033b60

Browse files
committed
fix(hash): remove entirely
1 parent 7418a2a commit 0033b60

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/runRoutes.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ export function runRoutes(
3232

3333
const hash = document.location.hash.replace(hashReplace, '');
3434

35-
// todo: maybe replace with history.replaceState to completely clear the url?
36-
// currently keeps #
37-
document.location.hash = '';
35+
try {
36+
history.pushState(
37+
'',
38+
document.title,
39+
window.location.pathname + window.location.search
40+
);
41+
} catch (_) {
42+
window.location.href.substr(0, window.location.href.indexOf('#'));
43+
}
3844

3945
// earliest possible bail on any match
4046
if (hash.match(errorRoute)) {

0 commit comments

Comments
 (0)