Skip to content

[File-Router] support matching wildcard views with subdirectories #3316

@taefi

Description

@taefi

Describe the bug

There is a case for handling the wildcard route params that seems to be edgy and doesn't provide a good DX.

With a directory structure like this:

/views
├── customers
│   ├── {id}
│   │   ├── edit.tsx
│   │   └── @index.tsx
│   ├── @index.tsx 
│   └── new.tsx
└── {...wildcard}.tsx

Due to the existence of the {id} directory under customers, navigating to the /customers/new/123 is not matched to the wildcard view at the root (under views), and will not match anything else either.

The workaround is to add another {…wildcard}.tsx under views/customers/{id} (and not under the view/customers/ because this is not get matched either).

Expected-behavior

With the described behaviour, for implementing a simple "Not Found" view, the users need to pollute the views subdirectories by adding many wildcard views (under each directory that has parameter directory such as {id}, which happens to be a common case).

I'd expect that the wildcard view defined under the root directory to handle all the non-matched routes.

Reproduction

Any project from the start with the above-mentioned view directory structure reproduces the issue.

System Info

Tested with 24.7.0.beta1

Metadata

Metadata

Assignees

Type

No type

Projects

Status

September 2025 (24.9)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions