-
Notifications
You must be signed in to change notification settings - Fork 61
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
[File-Router] wildcard view is not matched if subdirectories with parameters in their name exist #3316
Comments
Note: a top-level |
We could reuse the logic we have for adding Flow fallback for the wildcards. |
During discussion, we realised that we need a better definition for the expected FS router behavior regarding various combinations of:
|
Let's also consider behavior with #3344 |
The following are valid cases that are not easy to achieve due to how the React Router is configured based on the directory structure:
|
In case if global wildcard should not apply to
|
Considering the use cases above, it would make sense to make |
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:
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 (underviews
), and will not match anything else either.The workaround is to add another
{…wildcard}.tsx
underviews/customers/{id}
(and not under theview/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
The text was updated successfully, but these errors were encountered: