Skip to content

Commit

Permalink
🐛 fix: page desync if hash changed manually
Browse files Browse the repository at this point in the history
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
  • Loading branch information
SimonShiki committed Oct 29, 2023
1 parent 962ec50 commit 3ab5320
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ function App () {
window.opener.postMessage({type: 'allocate'}, '*');
});

onMount(() => {
window.addEventListener('hashchange', () => {
const currentPage = window.location.hash.trim().slice(1);
if (currentPage !== page()) {
navigateTo(currentPage);
}
});
});

return (
<>
<Navigation
Expand Down

0 comments on commit 3ab5320

Please sign in to comment.