nav: add history entry only once onload

reloading the page always added a history entry breaking back
button functionality.

fixed by only adding a history entry on load if the history is
empty, so that reloads will not add the same entry over and over
again.
pull/81/head
OFF0 11 months ago
parent cd7dfa3f19
commit 5ef45d93d3
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -216,7 +216,11 @@ const route = (path: string) => {
// onload
route(location.pathname);
history.pushState({}, '', location.pathname);
// only push a new entry if there is no history onload
if (!history.length) {
history.pushState({}, '', location.pathname);
}
window.addEventListener('popstate', (event) => {
route(location.pathname);

Loading…
Cancel
Save