-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
Next/link triggering momentary 'Unhandled Runtime Error' only in dev mode #28560
Comments
+1 multiple of my projects are running into this issue too |
@simongowing1 We downgraded to |
Thanks for the tip @roncodingenthusiast ! I appreciate that. The code does work, just with the error in dev mode. And even without it in production. But I'd really like to know whether theres something I could improve in the code for future. Or if this is an issue with Next more broadly. It's really bugging me. |
Yeah I definitely agree. Mine is only in dev mode too. I also don't think it is a code issue if downgrading to |
We had this same issue but we realized that we had some casing mismatches on our filepaths and our hrefs. We had note: you may want to fix this in your apps (if the mismatch is your issue). we were experiencing full-page reloads instead of client-side loads on page transitions that threw the error in dev mode. |
To add some additional context; I am upgrading an older app from Next 8 to 11 and ran into this issue, too. This app doesn't use dynamic routes ( <Link href={`/checkin/attendees?e=${eventGuid}`}>
<a className="linkList">{/* a bunch of content here; divs/etc. */}</a>
</Link> Downgrading to 11.0.1 does seem to make the "failed to load script" error in dev mode stop. |
I've been running into this every time I try to update to the latest version of Next. 😞 I'm suck on v10 (or I guess v11.0.1 at least based on above info) for now until this is resolved. I will say, to add to the discussion, for me I believe it's related to links to dynamic routes. I have a page Happy to provide any additional info that might be helpful for debugging this! |
This ensures we properly catch the rejection on route change failure in development so the dev overlay doesn't flash with the unhandled rejection. A test case isn't able to be added for this specific scenario as the unhandled rejection is fired right before the page is navigated so we can't consistently check if the rejection was unhandled or not. ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes: #28560
Hi, this has been updated in |
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. |
This ensures we properly catch the rejection on route change failure in development so the dev overlay doesn't flash with the unhandled rejection. A test case isn't able to be added for this specific scenario as the unhandled rejection is fired right before the page is navigated so we can't consistently check if the rejection was unhandled or not. ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes: vercel#28560
What version of Next.js are you using?
11.1.0
What version of Node.js are you using?
14.15.3
What browser are you using?
Firefox
What operating system are you using?
macOS
How are you deploying your application?
Issue refers to Dev mode only
Describe the Bug
In dev mode, I am getting a momentary runtime error when I click on a dynamic next/link. The error appears for a couple of seconds then the required page renders correctly.
NB the error cannot be replicated in production.
Error
Link
File Structure to page I am trying to reach:
pages/[venueId]/events/detail/[...slug].tsx
The error persists if I attempt to replicate the file structure in my href. Same error with the code as follows:
The one thing that does get rid of the error is if I simply paste the template literal from the 'as' prop in the 'href' and remove the 'as' prop:
This renders the required page swiftly and flawlessly without error. BUT when I try to navigate 'back' to the previous page using the browser 'back' button, it changes the URL to the correct address for the previous page, but remains on the same page.
Expected Behavior
As a user I want to be able to click on a dynamic 'event' link in a list and have the respective 'detail' content rendered without an error temporarily flashing up.
When I have finished with the information, I want to be able to click the browser's 'back' button and be returned to the previous page with the list of dynamic links.
To Reproduce
Link in question
File Structure to page I am trying to reach:
pages/[venueId]/events/detail/[...slug].tsx
The text was updated successfully, but these errors were encountered: