Skip to content

Parallel routes intercepting does not work #54636

Closed as not planned
Closed as not planned

Description

@shiroyasha9

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 23.0.0: Fri Aug 18 00:02:20 PDT 2023; root:xnu-10002.1.11~5/RELEASE_ARM64_T8103
    Binaries:
      Node: 18.17.1
      npm: 9.6.7
      Yarn: 1.22.19
      pnpm: 8.7.0
    Relevant Packages:
      next: 13.4.20-canary.9
      eslint-config-next: 13.4.19
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

App Router

Link to the code that reproduces this issue or a replay of the bug

https://github.com/shiroyasha9/teensy/tree/feature/migrate-to-next13

To Reproduce

  • Clone the repo and ensure that the branch is migrate-to-next13
  • Populate .env using the .env.example (any string values can be entered for GOOGLE_ID, GOOGLE_SECRET, NEXTAUTH_SECRET and SECRET_KEY to test out the bug)
  • pnpm i followed by pnpm dev
  • From the index page, click the login button on the top right. Expected behaviour is that it will be intercepted and open as a modal. However, it opens as a separate URL.

Describe the Bug

So I followed the official tutorial provided for using parallel routes and intercepting routes together to create an experience where if the user clicks on sign in while being on a page, it opens up as a modal overlaying the previous page, otherwise when being navigated to the page directly it loads as a separate page.

The weird thing is that the same code works on a different repo, and also the nextgram example. However in this project, the route simply does not get intercepted. Below attached is the screenshot for the log that appears when navigating to it using the login button
image

Folder structure
image

I have tried the canary releases, downgrading to the version of next that was used in nextgram example, even copy pasting the nextgram example code here. But none of the routes seem to be ever intercepted. I thought the pages router might be conflicting (I am in a middle of a migration to app router), so I even tried deleting it, but to no avail.

To check the deployed version, please check this link https://teensy-3n9c0y53y-shiroyasha9.vercel.app/

Video of the current behaviour, if that helps
https://github.com/vercel/next.js/assets/48734821/17d63fcd-ada0-4500-a77c-325841ffd922

Would love some help on this topic, thanks a lot

Expected Behavior

The /login route should have been intercepted and opened as a modal, instead of going to the standalone route.

Which browser are you using? (if relevant)

Arc Version 1.5.0 (41058) Chromium Engine Version 116.0.5845.110

How are you deploying your application? (if relevant)

Vercel

Activity

  1. added
    bugIssue was opened via the bug report template.
    on Aug 27, 2023
  2. danjiro commented on Aug 28, 2023

    @danjiro

    try adding a layout.tsx in (auth) that renders props.auth

  3. shiroyasha9 commented on Aug 28, 2023

    @shiroyasha9
    Author

    try adding a layout.tsx in (auth) that renders props.auth

    This does not work, as it says it is not a valid layout prop in that folder. I have added a layout.tsx in the root directory which renders the authModal. As I said, I had used the same exact code in a different repo, and there everything works. It is just in this project that I am facing this issue.

  4. shiroyasha9 commented on Aug 28, 2023

    @shiroyasha9
    Author

    Wow, okay so this is weird
    I was able to make this work by removing the following lines from my next.config.js.

      i18n: {
        locales: ["en"],
        defaultLocale: "en",
      },
    

    I am not sure how this was affecting the interception of the route, and would love some explanation on it, thanks!

  5. baufometic commented on Oct 6, 2023

    @baufometic

    Temporary workaround that fixed it for me in VSCode:

    • Ctrl-Shift-P
    • TypeScript: Select TypeScript Version
    • Use VSCode's Version

    Note that I have TypeScript 5.2.2 installed as a project dev dependency, as well as 5.2.2 as the VSCode version.

  6. renovatt commented on Nov 3, 2023

    @renovatt

    "next": "13.4.19",

    I'm facing a slightly strange problem, I don't know if I'm missing something.

    I have a project that is already working normally, the dynamic routes together with route interception, everything is ok. The folder structure is as follows:
    Captura de tela 2023-11-03 112111

    link: https://portfolio-renovatt.vercel.app/views/projects
    Note: the route is being intercepted, the background remains the same.

    But I'm trying to use hidden routes, (views), putting them in parentheses, and following the same structure, following the same pattern, route interception doesn't work correctly.

    An error occurs where the original route and the intercepted route are called together.

    I changed the structures a few times and found these two repositories, which I found in other issues:
    #49614
    https://github.com/vetledv/repro-intercept/blob/main/src/app/(some-group)/%40modal/(.)photos/%5Bid%5D/page.tsx
    https://github.com/Apestein/nextflix/blob/main/src/app/(main)/%40modal/(.)show/%5Bid%5D/page.tsx

    They are doing it like this, placing @modal inside (main), but when I do this, the route appears in the URL , however the screen is not changed, in this case my component does not appear, but if I update the page the original route happens, but just by placing (views) as the parent folder, the intercepted route happens, but with the same error as before , where the original route and the intercepted route are called together.

    Captura de tela 2023-11-03 111949
    Captura de tela 2023-11-03 111653

    I don't understand why this happens, can anyone help me?

  7. renovatt commented on Nov 7, 2023

    @renovatt

    "next": "13.4.19",

    I'm facing a slightly strange problem, I don't know if I'm missing something.

    I have a project that is already working normally, the dynamic routes together with route interception, everything is ok. The folder structure is as follows: Captura de tela 2023-11-03 112111

    link: https://portfolio-renovatt.vercel.app/views/projects Note: the route is being intercepted, the background remains the same.

    But I'm trying to use hidden routes, (views), putting them in parentheses, and following the same structure, following the same pattern, route interception doesn't work correctly.

    An error occurs where the original route and the intercepted route are called together.

    I changed the structures a few times and found these two repositories, which I found in other issues: #49614 https://github.com/vetledv/repro-intercept/blob/main/src/app/(some-group)/%40modal/(.)photos/%5Bid%5D/page.tsx https://github.com/Apestein/nextflix/blob/main/src/app/(main)/%40modal/(.)show/%5Bid%5D/page.tsx

    They are doing it like this, placing @modal inside (main), but when I do this, the route appears in the URL , however the screen is not changed, in this case my component does not appear, but if I update the page the original route happens, but just by placing (views) as the parent folder, the intercepted route happens, but with the same error as before , where the original route and the intercepted route are called together.

    Captura de tela 2023-11-03 111949 Captura de tela 2023-11-03 111653

    I don't understand why this happens, can anyone help me?

    I managed to fix this problem, solution:
    I created the parallel route @modal outside the hidden route (views) and just placed the dynamic route following the same path, directly, without saying that it is inside the (views) route, this way it will actually be intercepted, this way I can normally call it /project/id.

    I tested several ways, and I saw that calling the @modal route inside the (views) route was calling both routes at the same time, and the other way was calling the route but the component was not being used intercepted.

    I hope this can help others with the same problem.
    Captura de tela 2023-11-07 153738
    Captura de tela 2023-11-07 153930

  8. github-actions commented on Jan 12, 2024

    @github-actions
    Contributor

    We cannot easily recreate the issue with the provided information. Please add a minimal reproduction in order for us to be able to help more efficiently.

    Why was this issue marked with the please simplify reproduction label?

    There was a reproduction provided, but due to its complexity, we cannot easily reproduce the issue.

    An ideal minimal reproduction (unless relevant):

    • is not part of a monorepo
    • does not require secrets to run
    • does not reference private registry dependencies
    • has as few dependencies as possible
    • excludes unrelated pages/routes
    • does not require a database/third-party service to run
    • only includes the code necessary to reproduce the issue
    • is tested against next@canary to make sure your issue has not already been fixed

    In general, assume that we should not go through a lengthy onboarding process at your company code only to be able to verify an issue.

    If you cannot create a clean reproduction, another way you can help the maintainers' job is to pinpoint the canary version of next that introduced the issue. Check out our releases, and try to find the first canary release that introduced the issue. This will help us narrow down the scope of the issue, and possibly point to the PR/code change that introduced it. You can install a specific version of next by running npm install next@<version>.

    What happens if I don't provide a sufficient minimal reproduction?

    Issues with the please simplify reproduction label that receive no meaningful activity (e.g. new comments with a simplified reproduction link) are automatically closed and locked after 30 days.

    If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.

    I did not open this issue, but it is relevant to me, what can I do to help?

    Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps.

    I think my reproduction is good enough, why aren't you looking into it quicker?

    We look into every Next.js issue and constantly monitor open issues for new comments.

    However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

    Providing a minimal reproduction from the start without asking helps us look into issues much more quickly, as we can easily verify if the reported bug is related to Next.js. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

    Useful Resources

  9. remib18 commented on Jan 13, 2024

    @remib18

    From my understanding, this issue is related to route groups and intercepting routes. It seems the route groups are causing the router to ignore the interception. I tried to remove the group and it worked.

  10. TechSynthesis commented on Feb 15, 2024

    @TechSynthesis

    @remib18 have you found any fix for this?

  11. balazsorban44 commented on Mar 21, 2024

    @balazsorban44
    Contributor

    This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.

  12. github-actions commented on Apr 5, 2024

    @github-actions
    Contributor

    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.

  13. locked as resolved and limited conversation to collaborators on Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.lockedplease simplify reproductionPlease simplify the reproduction.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions