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
parent
cd7dfa3f19
commit
5ef45d93d3
|
@ -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…
Reference in New Issue