diff --git a/frontend/plugins/scrollToTop.client.ts b/frontend/plugins/scrollToTop.client.ts index 7a9bcd0..ada8613 100644 --- a/frontend/plugins/scrollToTop.client.ts +++ b/frontend/plugins/scrollToTop.client.ts @@ -1,5 +1,12 @@ export default defineNuxtPlugin((nuxtApp) => { + let previousPath: string | null = null; + nuxtApp.hook("page:finish", () => { - window.scrollTo(0, 0); + const currentPath = useRoute().fullPath; + + if (previousPath !== currentPath) { + window.scrollTo(0, 0); + previousPath = currentPath; + } }); });