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

fix(router): prevent 404 for routes consisting solely of an optional parameter #2798

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ghalle
Copy link

@ghalle ghalle commented Dec 21, 2024

This PR fixes an issue where if a route would start with an optional parameter and would not be followed by any other segments it wouldn't be able to match without the parameter being present.

Prior to this PR creating a route like /[[name]].tsx would result in a url pattern like {/:name}? which would work for /foo but would fail for /

After this PR, the pattern will now be /{:name}? which matches correctly for both / and /foo
Routes containing more segments like /[[name]]/bar.tsx were unaffected and will retain the same pattern as before.

@ghalle ghalle changed the title fix(router): 404 for routes starting with an optional parameter fix(router): prevent 404 for routes consisting solely of an optional parameter Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant