-
Notifications
You must be signed in to change notification settings - Fork 26.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
Router.push breaks on relative paths for old browsers (Chrome 49, IE11) #11702
Comments
Upgrading to |
@janjarfalk unfortunately, it did not fix it for me. Do you remember which error you were experiencing before the upgrade? What browsers did you test it with? |
This should be fixed 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. |
Bug report
Describe the bug
When using router.push with a relative url on older browsers, it will throw an error (in dev) or silently fail (in prod). E.g.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Invalid href passed to router
Expected behavior
There should be no discrepancies between the 2 behaviors
System information
Additional context
I tracked the issue down to this call here
https://github.com/zeit/next.js/blob/b274fe39d38111588e625342a89dc568ad38fff5/packages/next/next-server/lib/router/router.ts#L395
this will evaluate differently based on whether or not the polyfill is used.
When the native URL is used,
protocol
will benull
, when the polyfill version is used,protocol
will behttp://
, thus throwing the error just below the mentioned line.This is caused by the polyfill not throwing when an invalid URL is created, like
new URL('/foo')
, and triggering a different behavior onnative-url
.A PR has just been merged regarding this bug and will hopefully get published soon lifaon74/url-polyfill#54
The text was updated successfully, but these errors were encountered: