Link Component does not prefetch on network recovery. #69999
Labels
bug
Issue was opened via the bug report template.
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
Performance
Anything with regards to Next.js performance.
Link to the code that reproduces this issue
https://github.com/refirst11/reproduction-app
To Reproduce
Sometimes unnecessary mounts are run.
And canary release e2e testing is special.
Let's say the start of the route is "/" and it goes offline in this state.
"/a", "/b", and "/c" are in the viewport at this point, so there will be a smooth transition when transitioning to them.
And it is not possible to transition to links "/d", "/e", and "/f" on pages a, b, and c at this point, but let's say the network is restored, for example in a subway or train tunnel. In that case, when transitioning to pages d, e, and f, a network request will be sent and the page will be reloaded as in the a tag.
I call this mounting on recovery in Next.js.
However, since prefetch only needs to hit when the network restarts,
I thought it would be fixed by adding the following to the dependencies in React.useEffect.
In my environment, when I tried e2e testing next.js,
pnpm test-dev test/e2e/app-dir/app-prefetch/prefetching.test.ts
It's possible that I overlooked this, but all of the test code in the describe block of prefetching.test.ts passes (even if it fails), so I decided to write this as an issue here.
Current vs. Expected behavior
When the network becomes online, link components in the viewport are prefetched.
Provide environment information
Which area(s) are affected? (Select all that apply)
create-next-app, Performance
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local), Vercel (Deployed), Other (Deployed)
Additional context
Deploy is with vercel and next start.
I've been using Next.js since version 11, but even back then there was no prefetching during network restarts.
I want to improve
e2e test case
The text was updated successfully, but these errors were encountered: