Closed dimfeld closed 3 years ago
Hmm... Thanks for great work. But it is important that every slug is a single parameter. Wildcard option is not easy to understand. It is simpler to get part of URL from the router
object.
How would you recommend handling a case similar to this?
<Route path="app/*">
<Route path="/authors/:author/*">
... other routes
<Route path="/notes/*" let:params>
<Notes type="author" path={params['*']} />
</Route>
</Route>
<Route path="/books/:book/*">
... other routes
<Route path="/notes/*" let:params>
<Notes type="book" path={params['*']} />
</Route>
</Route>
</Route>
This is just a contrived example, not a real use case. But it's similar to what I have in mind, and it seems error-prone if you have highly nested routes and the Notes route and component has to try to figure out the entire parent URL context to know what part at the end to slice off.
it shouldn't be in params
. May be other variable where will be stored path of the route.
I'll think about it. Same feature need to be to organize breadcrumbs for example.
Ok, thanks for your consideration!
See new meta
feature https://github.com/AlexxNB/tinro#route-meta
It may help you.
Yes, I think that will work nicely. Thanks!
This exposes the contents of a matched wildcard to non-exact routes. It's most useful when the contents of the wildcard needs to be parsed further, used in a fetch request, and so on, but it may contain one or more slashes so a parameter like
:foo
won't work.