-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Bug?]: Missing parameter for route when using glob pattern #6319
Comments
I'm assuming the syntax for the navigate link is as above, although if I remove the ... the app loads and functions correctly, e.g.:
However, I then get a TS error: TS2345: Argument of type ‘{ categoryIds: any; }’ is not assignable to parameter of type ‘{ “categoryIds…”: string; } & QueryParams’. Property ‘“categoryIds…”’ is missing in type ‘{ categoryIds: any; }’ but required in type ‘{ “categoryIds…”: string; }’. |
Hey @cattre thanks for the Gitpod snapshot! 🚀 As you mentioned in your second comment it looks like the types Redwood generates wrong. Let me step through babel-plugin-redwood-routes-auto-loader to see exactly what's going on there. |
The generator also need updating so that the page it generates doesn't throw; it needs a parameter. |
So turns out the utility type here doesn't handle glob routes, so this now very much a TS problem |
I had this problem because of a link without a parameter in the layout. |
What's not working?
I'm trying to change a couple of routes to use the glob param pattern, in order to work with nested items, e.g.:
<Route path='/category/{categoryIds...}/edit' page={CategoryEditCategoryPage} name='editCategory' />
This working fine when I manually enter the URL, but I get an error when creating navigate links, e.g.:
<Link to={routes.editCategory({ 'categoryIds...': category.id })}>Edit</Link>
How do we reproduce the bug?
https://gitpod.io#snapshot/f051b363-f867-42e0-8153-8c300d52439e
Navigate to categories list - https://8910-redwoodjs-gitpodstarter-im8r4cjqmdr.ws-eu63.gitpod.io/categories
What's your environment? (If it applies)
System: OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa) Shell: 5.0.17 - /bin/bash Binaries: Node: 16.13.2 - /tmp/xfs-12e552be/node Yarn: 3.2.0 - /tmp/xfs-12e552be/yarn Databases: SQLite: 3.31.1 - /usr/bin/sqlite3 npmPackages: @redwoodjs/core: 2.2.3 => 2.2.3
Are you interested in working on this?
The text was updated successfully, but these errors were encountered: