chore: simplify conditional statements

This commit is contained in:
Damian Glowala 2024-09-14 10:36:49 +02:00
parent d8d89b9dee
commit df5038a272
1 changed files with 6 additions and 8 deletions

View File

@ -28,15 +28,13 @@ export default <RouterConfig> {
} }
// Hash routes on the same page, no page hook is fired so resolve here // Hash routes on the same page, no page hook is fired so resolve here
if (to.path === from.path) { if (to.path === from.path && !to.hash) {
if (!to.hash) { if (from.hash) {
if (from.hash) { return { left: 0, top: 0 }
return { left: 0, top: 0 }
}
// The route isn't changing so keep current scroll position
return false
} }
// The route isn't changing so keep current scroll position
return false
} }
// Wait for `page:transition:finish` or `page:finish` depending on if transitions are enabled or not // Wait for `page:transition:finish` or `page:finish` depending on if transitions are enabled or not