From 076e37847c06621986806b481620d5c9a026852c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Tue, 27 Dec 2022 16:01:16 +0300 Subject: [PATCH] refresh blink fix --- middleware/route.global.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/middleware/route.global.js b/middleware/route.global.js index d3a517024..3d2a54f4d 100644 --- a/middleware/route.global.js +++ b/middleware/route.global.js @@ -1,9 +1,9 @@ export default defineNuxtRouteMiddleware((to, from) => { useNuxtApp().hook('page:finish', () => { - if (history.state.scroll) { - setTimeout(() => window.scrollTo(history.state.scroll), 0); + if (to.path !== from.path && history.state) { + window.scrollTo(history.state.scroll); } else { - setTimeout(() => window.scrollTo(0, 0), 0); + window.scrollTo(0, 0); } }); });