Skip to content

Commit

Permalink
Merge pull request #137 from fritx/fix-backbtn-popstate
Browse files Browse the repository at this point in the history
Fix back button popstate not working on the first pushState
  • Loading branch information
tipiirai authored Jan 3, 2024
2 parents 19acf49 + 3756202 commit 06e1336
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/nuekit/src/browser/page-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export function setSelected(path, className='selected') {
}


// Fix: window.onpopstate, event.state == null?
// https://stackoverflow.com/questions/11092736/window-onpopstate-event-state-null
is_browser && history.pushState({ path: location.pathname }, 0)


// autoroute / document clicks
is_browser && onclick(document, (path) => {
loadPage(path)
Expand Down

0 comments on commit 06e1336

Please sign in to comment.