refresh blink fix

pull/3449/head
Tuğçe Küçükoğlu 2022-12-27 16:01:16 +03:00
parent 63d1a6bd9c
commit 076e37847c
1 changed files with 3 additions and 3 deletions

View File

@ -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);
}
});
});