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

Catch-all routes aren't generated right when the name isn't a valid JS identifier but is a valid NextJS route #49

Closed
OliverDudgeon opened this issue Aug 7, 2022 · 3 comments · Fixed by #52

Comments

@OliverDudgeon
Copy link

OliverDudgeon commented Aug 7, 2022

If I have an route which catches all subpaths such as "/api/as-api/[...as-proxy]" the generated route is { pathname: "/api/as-api/[...as-proxy]"; query: Query<{ as-proxy: string[] }> }. Notice that there is a key, as-proxy, which is missing quotes to allow it to be a valid object key.

Using v0.0.18

@tatethurston
Copy link
Owner

Thanks for reporting this @OliverDudgeon.

Thinking on the solution, we could quote all user supplied segments, or try to determine the subset that aren’t valid JS identifiers.

@tatethurston
Copy link
Owner

tatethurston commented Aug 7, 2022

Out of curiosity, why do you prefer as-proxy overasProxy? The former will be less ergonomic in your code, and it’s not exposed to end users.

@OliverDudgeon
Copy link
Author

Nothing preventing this for me

tatethurston added a commit that referenced this issue Aug 8, 2022
tatethurston added a commit that referenced this issue Aug 8, 2022
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 a pull request may close this issue.

2 participants