chore: simplify logic

This commit is contained in:
userquin 2023-02-11 00:23:58 +01:00
parent 9bc00be29a
commit 1241921435

View file

@ -33,20 +33,15 @@ export default defineNuxtPlugin((nuxtApp) => {
return return
} }
if (!route.meta || !route.meta?.noScrollTrack) { const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath)
const r = ignoreCustomRoutes ? undefined : customRoutes.has(route.fullPath) if (r) {
if (r) { reject(new Error('custom routed detected'))
reject(new Error('custom routed detected')) return
return }
}
const scrollPosition = storage.value[route.fullPath] const scrollPosition = storage.value[route.fullPath]
if (scrollPosition) if (scrollPosition)
window.scrollTo(0, scrollPosition) window.scrollTo(0, scrollPosition)
}
else {
forceScroll()
}
resolve() resolve()
}, 600) }, 600)