Skip to content

Commit

Permalink
fixed broken url slug loading object behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
p3t3r67x0 committed Dec 7, 2024
1 parent 6361a81 commit af255df
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,14 @@ document.querySelector('#sidebarCloseButton').addEventListener('click', function


window.onload = () => {
if (!history.state) {
const path = decodeURIComponent(window.location.pathname)

if (!history.state && path === '/') {
history.replaceState({ screen: 'home' }, '', '/')
}
else if (!history.state && path !== '/') {
history.replaceState({ screen: path }, '', path)
}
}

// Handle popstate event when navigating back/forward in the history
Expand Down

0 comments on commit af255df

Please # to comment.