Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router.push hangs and does not trigger hard reload if router.prefetch fails to load a file more than once #28038

Closed
timswalling opened this issue Aug 12, 2021 · 4 comments
Labels
bug Issue was opened via the bug report template.

Comments

@timswalling
Copy link

timswalling commented Aug 12, 2021

What version of Next.js are you using?

11.1.0

What version of Node.js are you using?

14.x

What browser are you using?

Chome - Version 92.0.4515.131 (Official Build) (x86_64)

What operating system are you using?

macOS 10.15.7

How are you deploying your application?

Vercel

Describe the Bug

If router.prefetch fails to load a file twice subsequent router.push calls for the route do not attempt to load the file and do not resolve. No routeChangeCompleted or routeChangeError events fire, and a hard reload is not triggered.

Expected Behavior

The router.push call will attempt to load the missing file. If the file still cannot be loaded a routeChangeError event will fire, the router.push call will resolve with a value of false, and a hard reload will be used to load the target route.

To Reproduce

Example repo: https://github.com/timswalling/next-prefetch-bug

  • Go to https://next-prefetch-bug.vercel.app/ in Chrome
  • Using devtools, enable network request blocking on next-prefetch-bug.vercel.app/_next/static/chunks/pages/page-2-*.js
  • Click on the router.prefetch button and verify that the page-2 chunk fails to load
  • Click on the router.prefetch button and verify that the page-2 chunk fails to load again
  • Click on router.push and verify that no further attempt is made to load the page-2 chunk, and that the router.push call does not resolve
@timswalling timswalling added the bug Issue was opened via the bug report template. label Aug 12, 2021
@hotsummmer
Copy link

I think other people(including me) are experiencing it too😢
#27783

@timswalling
Copy link
Author

I've tried upgrading to next@v11.1.1-canary.6, but it doesn't fix this issue.

@ijjk
Copy link
Member

ijjk commented Sep 18, 2021

Hi, this should be fixed in v11.1.3-canary.24 of Next.js, please update and give it a try!

@ijjk ijjk closed this as completed Sep 18, 2021
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

4 participants