-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Multiple rest parameters: Make eagerness configurable or respect parameter matcher #12127
Comments
This kind of sounds like a stick to beat you with considering your param is rest and can contain both slashes and the next segment separator. I see multiple solutions without expanding the params API (which has little to none room left):
The rest parameters docs has an example demonstrating exactly what you are trying to do, is there anything different in your case? |
The repository identifiers are relatively free form. The might match
It seems like these would have to go together since
That would result in the same problem if file path contains
It's an existing application that I'm build a prototype in SvelteKit for. |
Describe the problem
I was on the fence whether to file this as a bug report or feature request.
Consider the following route,
/[...repo]/-/[...path]
, whererepo
would be an arbitrary repository name andpath
an arbitrary file path. Having apath
that also contains the "separator"/-/
causes a problem. Therepo
rest parameter matches eagerly, i.e. it uses the longest match. Given a destination like/repo/-/some/path/-/to/file
, the parameters would be matched aswhereas the desired match is
Changing the route to include a parameter matcher that ensures that
repo
doesn't contain/-/
doesn't solve the problem either. Instead of trying a shorter match SvelteKit considers the page to not exist.Here is a reproduction of the issue: https://github.com/fkling/sveltekit-rest-parameters-demo
Describe the proposed solution
It would be great if there was a way to indicate that a rest parameter should by lazy instead of eager or if SvelteKit would keep trying different slices of the path when the parameter matcher returns
false
.Alternatives considered
Using parameter matchers was the alternative that I tried, but that didn't have the desired result. I don't see any other way to achieve this behavior.
Importance
i cannot use SvelteKit without it
Additional Information
I selected importance as "i cannot use SvelteKit without it" because our application has to work on arbitrary (customer) data. I.e we don't have control over the file paths used by customers (we have some control over the repository name mapping).
Somewhat ironically this issue prevents us from browsing the corresponding SvelteKit files with our app in our own repository.
The text was updated successfully, but these errors were encountered: