-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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() causes an error on intercepted route #65162
Comments
<button
onClick={() => {
router.push("/signin");
router.refresh();
}}>
{"to signin"}
</button>
|
hello, i am unable to reproduce it in 14.3.0-canary.37. could you try and give a quick update on that version please? |
Because it is a part of the issue. Actually, that is the way i tried to make intercepted routes work in my main app. If i didnt use router.refresh(); then i couldnt navigate to the intercepted page in some cases. |
error still exist both in the sandbx with the mentioned next version and in my main app |
Hi @Neutrlno -- both of your reproductions seem to have this pattern of routing to a new page and triggering You mentioned:
To me, that sounds like maybe you were having trouble with the soft navigation behavior described here. Are you able to share an updated repro of what you weren't able to get working, without |
@ztanner i updated https://codesandbox.io/p/devbox/shy-sky-lnkhzt sandbox with extra buttons that don't use refresh. When using them, the modal closing and navigating from it work as expected just for the first time. When you continue navigating back and forward between secondary and signin - navigation just stops to work. I tried to add [...catchAll] with a page.tsx file that returns null in a @modal slot with no effect. I just want to implement a intercepted route modal window from which i can navigate to other routes. But i always fail. Help me achieve that By the way, |
Hi @Neutrlno -- it seems there was still a I forked your Sandbox here, and added the catch-all, and it seems to work consistently for me: |
I'm going to close this issue as I cannot reproduce and the above sandbox demonstrates correct behavior, but feel free to reach back out if you're unable to get it to work. |
Just tested it in my main app with [...catchAll] and no router.refresh() - it works as expected with no issues.
The router.refresh() method was used because without [...catchAll] I couldn't navigate to the path; only the address bar was changed |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/shy-sky-lnkhzt
To Reproduce
Current vs. Expected behavior
Current: on step 3 error occures. Expected: no error
Provide environment information
Which area(s) are affected? (Select all that apply)
Parallel & Intercepting Routes
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
The yellow error that occures in the sandbox console is like this(copied from my VSCode console):
Performing hard navigation because your application experienced an unrecoverable error. If this keeps occurring, please file a Next.js issue.
Reason: Segment mismatch
Last Action: server-patch
Current Tree: ["",{"children":["(auth)",{"children":["forgot-password",{"children":["PAGE",{},"/forgot-password","refresh"]},null,null]},null,null],"authModal":["PAGE",{"children":["PAGE",{},"/","refresh"]},"/","refresh"]},null,null,true]
Tree Patch Payload: ["PAGE",{}]
The text was updated successfully, but these errors were encountered: