Skip to content
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 is mistaking index route for a dynamic route with fallback #22750

Closed
dennylouis opened this issue Mar 4, 2021 · 1 comment · Fixed by #22783
Closed

Router is mistaking index route for a dynamic route with fallback #22750

dennylouis opened this issue Mar 4, 2021 · 1 comment · Fixed by #22783
Assignees
Milestone

Comments

@dennylouis
Copy link

dennylouis commented Mar 4, 2021

What version of Next.js are you using?

10.0.7

What version of Node.js are you using?

14.12.0

What browser are you using?

Chrome, Safari, Firefox

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

The Next.js router is mistaking the index.js route as a dynamic route with a query of "index".

I have 2 pages:
- pages/index.js
- pages/[page].js with fallback

Occasionally when loading the index route, I am getting directed to the [page].js route which is returning as an error page.
The router at this point is looking like this:

{
  "pathname": "/[page]",
  "route": "/[page]",
  "query": {
    "page": "index"
  },
  "asPath": "/",
  "components": {
    "/[page]": {
      "initial": true,
      "props": {
        "pageProps": {
          "preview": false,
          "pageData": {}
        },
        "__N_SSG": true
      },
      "__N_SSG": true
    },
    "/_app": {
      "styleSheets": []
    }
  },
  "isFallback": false,
  "basePath": "",
  "isReady": true,
  "isLocaleDomain": false,
  "events": {}
}

Expected Behavior

The index route should load consistently

To Reproduce

Create an index.js page and a dynamic route page with fallback: true.

Load the index route in the browser and refresh until it does not display.

My site can also be viewed for an example: https://cappellazzo-website-cvrquuxk8-homestudio.vercel.app/

@dennylouis dennylouis added the bug Issue was opened via the bug report template. label Mar 4, 2021
@ijjk ijjk added kind: bug and removed bug Issue was opened via the bug report template. labels Mar 4, 2021
@ijjk ijjk self-assigned this Mar 4, 2021
@ijjk ijjk added point: 2 and removed point: 1 labels Mar 4, 2021
@kodiakhq kodiakhq bot closed this as completed in #22783 Mar 4, 2021
kodiakhq bot pushed a commit that referenced this issue Mar 4, 2021
This fixes the case where index page revalidation would match a dynamic page instead of the index page from the pathname not being denormalized. 

Fixes: #22750
@Timer Timer added this to the iteration 17 milestone Mar 4, 2021
@balazsorban44
Copy link
Member

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.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants