Skip to content

Duplicate object keys in $path.ts when same directory names exist under different Next.js Route Groups #197

@yuki555-j

Description

@yuki555-j

Description

Conflicting object keys in $path.ts for the following directory structure in AppRouter.

Conflict Pattern

└── app/
    ├── (layoutA)/
    │   ├── folder1
    │       └── page.tsx
    │   └── folder2
    │       └── page.tsx
    └── (layoutB)/
        └── folder2
            └── folder2_child_page
                └── page.tsx

No conflict pattern

└── app/
    ├── (layoutA)/
    │   └── folder2
    │       └── page.tsx
    │   ├── folder3
    │       └── page.tsx
    └── (layoutB)/
        └── folder2
            └── folder2_child_page
                └── page.tsx

Environment

  • Package version: v0.25.0
  • OS:
    • Linux
    • Windows
    • macOS
  • Node.js version: v23.10.0
  • npm version: v10.9.2

Additional context

Outputs in the event of conflicts.

export const pagesPath = {
  folder1: {
    $url: (url?: { hash?: string }) => ({
      pathname: '/folder1' as const,
      hash: url?.hash,
      path: `/folder1${buildSuffix(url)}`,
    }),
  },
  folder2: {
    $url: (url?: { hash?: string }) => ({
      pathname: '/folder2' as const,
      hash: url?.hash,
      path: `/folder2${buildSuffix(url)}`,
    }),
  },
  folder2: {
    folder1_child_page: {
      $url: (url?: { hash?: string }) => ({
        pathname: '/folder2/folder1_child_page' as const,
        hash: url?.hash,
        path: `/folder2/folder1_child_page${buildSuffix(url)}`,
      }),
    },
  },
  $url: (url: { query: Query_1j04kwd; hash?: string }) => ({
    pathname: '/' as const,
    query: url.query,
    hash: url.hash,
    path: `/${buildSuffix(url)}`,
  }),
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions