Skip to content

Commit

Permalink
fix(client): no onAfterRouteChanged called after popstate (#3227)
Browse files Browse the repository at this point in the history
closes #3226
  • Loading branch information
xiaodong2008 authored Nov 22, 2023
1 parent ef6d8d1 commit 60fc8fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/client/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ export function createRouter(
{ capture: true }
)

window.addEventListener('popstate', (e) => {
loadPage(
window.addEventListener('popstate', async (e) => {
await loadPage(
normalizeHref(location.href),
(e.state && e.state.scrollPosition) || 0
)
router.onAfterRouteChanged?.(location.href)
})

window.addEventListener('hashchange', (e) => {
Expand Down

0 comments on commit 60fc8fd

Please sign in to comment.