You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useAsyncData() blocks route navigation by default but scrollBehavior is not aware of that i guess so it fires before route navigation which causes scroll to top of page and then after data is fetched we are redirected to new page.
Additional context
So for now only way to handle this case is instead of using scrollBehavior use lazy: true in useAsyncData and after its finished use for example window.scrollTo(0,0) in component itself?
Under the hood, lazy: false uses to block the loading of the route before the data has been fetched. Consider using lazy: true and implementing a loading state instead for a snappier user experience.
On top of that without defining scrollBehavior when routing to new route, page is not scrolled to top by default, instead scroll stays at the same position as before - is it desired behavior or a bug?
Logs
No response
The text was updated successfully, but these errors were encountered:
Environment
Linux
v16.14.2
3.0.0-rc.3
npm@7.17.0
vite
-
-
-
Reproduction
https://stackblitz.com/edit/github-2vxhdz?file=app/router.options.ts
Describe the bug
useAsyncData()
blocks route navigation by default butscrollBehavior
is not aware of that i guess so it fires before route navigation which causes scroll to top of page and then after data is fetched we are redirected to new page.Additional context
So for now only way to handle this case is instead of using
scrollBehavior
uselazy: true
inuseAsyncData
and after its finished use for examplewindow.scrollTo(0,0)
in component itself?from docs: https://v3.nuxtjs.org/api/composables/use-async-data/#params
On top of that without defining
scrollBehavior
when routing to new route, page is not scrolled to top by default, instead scroll stays at the same position as before - is it desired behavior or a bug?Logs
No response
The text was updated successfully, but these errors were encountered: