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.back() not working when going back between two dynamic routes #25285
Comments
same here in production since 10.1 or 10.2
Not linked to a Link or router.push but this error is happening when browsing back the history (navigator back button for example) |
BTW I also have a base path 3 chars long (/gr) look like a wrong splice somewhere because |
Same here, I was about to open an issue but I found yours. The problem appears between It breaks my website so I had to rollback to 10.2.1 :( I also prepared something to reproduce the issue here: hope it will be fixed for 11.0.0, I'm so exited to try the incoming new features :D |
…5459) This ensures the `basePath` is correctly re-added to the `url` after resolving a dynamic route since the `url` stored in history is expected to already contain the `basePath`, an additional test has been added to ensure this is working correctly back/forward through history ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added Fixes: #25285
I'm sorry for reopening this closed issue but it seems it hasn't totally fixed the problem :'( I updated the reproduction url with latest Here is the updated example project to reproduce the bug: I also forked and updated the example from @DaniAkash that still show the same issue:
If I can help providing some more infos, I'd love to. [UPDATE] I suppose we need another ticket, not yet closed, so I commented under a new one I found mentionning this issue: #25490 |
…rcel#25459) This ensures the `basePath` is correctly re-added to the `url` after resolving a dynamic route since the `url` stored in history is expected to already contain the `basePath`, an additional test has been added to ensure this is working correctly back/forward through history ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added Fixes: vercel#25285
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. |
What version of Next.js are you using?
10.2.2
What version of Node.js are you using?
14.15
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
vercel
Describe the Bug
I have a dynamic route in the following format:
/path/[type]
If i visit the following paths:
/path/custom1
/path/custom2
and then call router.back() from custom2 I get the following error message:
I use my app with a basepath. It is happening only when I have a basepath. My next.config.js file is:
Given my application has lots of dynamic routes I'm unable to upgrade from 10.0 to 10.2.
Expected Behavior
The page should be able to go back from /path/custom2 to /path/custom1
To Reproduce
I have created a codesandbox with reproducable scenario:
https://znkfe.sse.codesandbox.io/app
If the buttons are followed, it will land on the issue.
Source: https://codesandbox.io/s/nextjs-routing-issue-znkfe?file=/pages/index.js
The text was updated successfully, but these errors were encountered: