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

API suggestion: catch-all routes use the chosen parameter name #26

Open
osdiab opened this issue Nov 12, 2021 · 2 comments
Open

API suggestion: catch-all routes use the chosen parameter name #26

osdiab opened this issue Nov 12, 2021 · 2 comments

Comments

@osdiab
Copy link
Collaborator

osdiab commented Nov 12, 2021

This is irrelevant if we go with #21 , but right now the getRoute function refers to the catch-all part of a route to be path, ignoring the name in the actual route. For instance, /foo/[...bar].ts would be populated with getRoute({route: '/foo/[...bar].ts', path: 'baz'}) instead of getRoute({route: '/foo/[...bar].ts', params: {bar: 'baz'}}).

I found it counterintuitive that while NextJS refers to those catch-all params as params, this library doesn't.

@ckastbjerg
Copy link
Owner

It's been awhile since I worked on the library, so forgive me if I'm not remembering correctly here...

But I believe I chose the path as you can have both params and path. E.g.:

getRoute({
  route: "/nested-catch-all/[dynamic]/slugs",
  params: { dynamic: 1 },
  path: "/a/b/c",
})

More details here: #13

Or are you arguing that they should be treated the same?

But yes, if the API surfaces was limited/the implementation changed, it might not matter I guess

@osdiab
Copy link
Collaborator Author

osdiab commented Nov 17, 2021

Yes, just saying it would be more consistent if they were treated the same.

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

No branches or pull requests

2 participants