-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support suffixes for [...rest] endpoints #4656
Comments
There is a bug here — because the client-side routing table doesn't include endpoints, the router doesn't 'see' that That said, how are you running into this bug? If you hit |
We had previously (#2656) decided to not tell the client-side router about endpoints, and had said if you wanted to link to them, you'd need |
No, I just forgot we'd made that call. Now that we've eliminated fallthrough, it's possible that we could reinstate the previous behaviour in a less costly way — maybe it's possible to only tell the client-side router about ambiguous cases like this one, rather than all endpoints. |
Having the client-side router know about endpoints (and use a full-page navigation in that case) only when there's an ambiguity - but to have it continue to show the client-rendered 404 page when linking to any other endpoint - sounds confusing to me. That's worse than either consistently having it know about endpoints or consistently having it not know about endpoints. |
Unmatched routes already trigger a full page navigation by default; the client only renders 404s for matched page routes, hence the bug with ambiguous routes. |
Oh! I had forgotten about that change. Yup, makes sense to just include this for potentially ambiguous endpoints. |
Thanks for looking into it. Here is a reproduction sandbox: https://stackblitz.com/edit/sveltejs-kit-template-default-pkjzkn?file=src/routes/index.svelte
That actually doesn't seem to be the case, that's why I opened it. I want to be able to both query the endpoint myself with let's say |
Ah okay, that seems to be a completely different bug — |
Found the issue: kit/packages/kit/src/core/sync/create_manifest_data/index.js Lines 386 to 388 in 062f38e
This comparison function does the sorting of values.
Since The first argument has more parts in the first segment, it wins. Can be fixed by adjusting compare(a,b) or id, segments logic |
This is impacted by #5748 and could possibly be closed by that? |
indeed it can :) |
Describe the problem
I have a project with a following pages routes structure:
What I am doing there:
/routes/posts/index.{svelte,json.js}
is a list page with every post/routes/posts/category*/**/*.svelte
are posts with just markup and some props/routes/posts/[...catchall]/index.svelte
fires when no post if found, so it queries/routes/posts/[...catchall]/index.json.js
to check if the post has an alias and redirectsWhat I would like to do is to add a generic
/likes.json
endpoint to all the posts, so:But the problem I am facing is that the request is routed to the
/routes/posts/[...catchall]/index.svelte
handler, even though according to sorting rules,likes.json
must have a priorityDescribe the proposed solution
Support catchall suffixes
Alternatives considered
I could solve this without having
[...rest]
matcher of course, but that involves either copy-paste, or manual routing.Importance
would make my life easier
Additional Information
This seems like an improvement of an existing feature
The text was updated successfully, but these errors were encountered: