Replies: 1 comment 5 replies
-
Short answer: If you use Long answer: You need to transfer state from the server to the client.
|
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, thanks for the awesome framework!
It seems to me like fetching data in <script setup> will fetch the data initially on the server, but then make the same request again on the client.
This can cause UX issues where the page looks to be done loading, but if the user starts scrolling down the page, they will be automatically moved to the top when the client side data has finished fetching.
I dont think Nuxt 2 worked this way (on SSR you couldn't see any fetch requests in the network tab). So I was wondering if the new behaviour is intended and/or there's a way to disable it? I understand that universal mode will hydrate the page, but I wasn't aware it would also refetch data like this.
Reproduction: https://stackblitz.com/edit/nuxt-starter-x9kb1p?file=pages%2F[...slug].vue
You can see in the console that the data is logged multiple times. And if you scroll down quickly after the initial render, you can see the scroll position being reset when the client-side render is done.
Appreciate any help on this!
Beta Was this translation helpful? Give feedback.
All reactions