Skip to content

Commit

Permalink
fix: ahref routing
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBLT committed Mar 9, 2024
1 parent d0c0ec4 commit b4b9c50
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/@hec.js/ui/lib/src/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ export const updateRouting = () => {
firstMatch = true;
meta.content = route.pattern.pathname;

updateGroup(route.group);
return route.group.length ? updateGroup(route.group) : true;
}
}
}

updateGroup(routes);
return updateGroup(routes);
}

const onNavigate = (event) => {
Expand All @@ -107,8 +107,11 @@ const onNavigate = (event) => {

if (href && url.hostname == location.hostname) {
if (routes.some(e => e.pattern.test(href))) {
history.pushState(null, null, href);
event.preventDefault();
_pushState.call(window.history, null, null, href);

if (updateRouting()) {
event.preventDefault();
}
}
}

Expand Down

0 comments on commit b4b9c50

Please sign in to comment.