Skip to content

Commit

Permalink
Update packages/kit/src/runtime/client/router.js
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Feb 7, 2022
1 parent 03dc15c commit b53bbbd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/kit/src/runtime/client/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ export class Router {
// Ignore if <a> has a target
if (a instanceof SVGAElement ? a.target.baseVal : a.target) return;

// Check if new url only differs by hash
// Check if new url only differs by hash and use the browser default behavior in that case
// This will ensure the `hashchange` event is fired
// Removing the hash does a full page navigation in the browser, so make sure a hash is present
const [base, hash] = url.href.split('#');
if (hash && base === location.href.split('#')[0]) {
// Call `pushState` to add url to history so going back works.
Expand Down

0 comments on commit b53bbbd

Please sign in to comment.