From 124192143544015b3877a413151715ef63b25fcd Mon Sep 17 00:00:00 2001 From: userquin Date: Sat, 11 Feb 2023 00:23:58 +0100 Subject: [PATCH] chore: simplify logic --- plugins/track-scroll-position.client.ts | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/plugins/track-scroll-position.client.ts b/plugins/track-scroll-position.client.ts index fa37e006..e1cdabd1 100644 --- a/plugins/track-scroll-position.client.ts +++ b/plugins/track-scroll-position.client.ts @@ -33,20 +33,15 @@ export default defineNuxtPlugin((nuxtApp) => { return } - if (!route.meta || !route.meta?.noScrollTrack) { - const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath) - if (r) { - reject(new Error('custom routed detected')) - return - } + const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath) + if (r) { + reject(new Error('custom routed detected')) + return + } - const scrollPosition = storage.value[route.fullPath] - if (scrollPosition) - window.scrollTo(0, scrollPosition) - } - else { - forceScroll() - } + const scrollPosition = storage.value[route.fullPath] + if (scrollPosition) + window.scrollTo(0, scrollPosition) resolve() }, 600)