From 93abc90b61198dea0764ca85af18fa2ac15126a1 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Thu, 23 Jan 2025 01:17:48 +0530 Subject: [PATCH] clean --- src/client/app/router.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/client/app/router.ts b/src/client/app/router.ts index ab8bb3b7..02ae16a7 100644 --- a/src/client/app/router.ts +++ b/src/client/app/router.ts @@ -97,14 +97,8 @@ export function createRouter( }) ) - if (hash) { - scrollTo( - hash, - cause ? cause.classList.contains('header-anchor') : false - ) - } else { - window.scrollTo(0, 0) - } + if (hash) scrollTo(hash, cause?.classList.contains('header-anchor')) + else window.scrollTo(0, 0) } return @@ -156,11 +150,8 @@ export function createRouter( history.replaceState({}, '', href) } - if (targetLoc.hash && !scrollPosition) { - scrollTo(targetLoc.hash) - } else { - window.scrollTo(0, scrollPosition) - } + if (targetLoc.hash && !scrollPosition) scrollTo(targetLoc.hash) + else window.scrollTo(0, scrollPosition) }) } }