Replies: 1 comment
-
I encountered this weird issue as well. I'm sharing my specific workaround in cases it helps someone. From nextjs source code, the
When debugging, I found that Later on, when a link with The workaroundI went through the component tree in my codebase and found that there is a client component that fetches remote data. While it is fetching, it returns The workaround is to make sure that |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Strange issue. I have a page to view a blog post, that is fetched from the cms. At the very bottom of the page I have a footer section for the blog post with its categories, tags, and related posts. Those are all link components to the respective pages.
When scrolling down the blog post, at some point the scroll just jumps back to the top of the page. Managed to figure out through DevTools it happens the moment any of those link components come into view and get prefetched.
Not really sure where to even start, as prefetching links shouldn't cause scrolling, and doesn't on any other page. Happens only the first time. Once the fetch is cached, it's all good. The other strange thing, it doesn't happen locally, only after deploying to Vercel, so a bit difficult to debug. I could replace Links with anchor tags or make a wrapper component with prefetch disabled, but would like the prefetch.
Code of the component (nothing special to see though): https://gist.github.com/Ma-Kas/e30a5d0aeae51ee4c2a3055dd8e81182
Beta Was this translation helpful? Give feedback.
All reactions