Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Fixes #765. Support zero-length [...rest] params. #780

Closed

Conversation

hitsthings
Copy link
Contributor

This is a breaking change since it changes the behavior of [...rest] params to additionally match
nothing.

[...rest] test routes were moved under /rest-variable because zero-length support would otherwise conflict with [slug].svelte.
A [...rest].svelte was added in place so that comparator would continue to implicitly test ...rest routes against other routes.

A design decision was made that abc-[...rest]-def.svelte wouldn't match abc-/foo/-def, only abc-foo/bar-def (no slashes at edges of [...rest] params within a segment).

This is a breaking change since it changes the behavior of [...rest] params to additionally match
nothing.

[...rest] test routes were moved under rest-variable because zero-length support would otherwise conflict with [slug].svelte.
A [...rest].svelte was added in place so that comparator would continue to implicitly test ...rest routes against other routes..

A design decision was made that `abc-[...rest]-def.svelte` wouldn't match `abc-/foo/-def`, only `abc-foo/bar-def` (no slashes at edges of [...rest] params within a segment).
@hitsthings
Copy link
Contributor Author

On re-reading #765 , this only handles [...rest] and doesn't make any optional params otherwise. The support for some-constant[[param]]whatever.svelte makes all this stuff wonky, but I think it wouldn't be too hard to add double bracket support if that's what you want. Let me know if you do.

@hitsthings
Copy link
Contributor Author

One thing I don't understand is the code to support something like index.whatever.svelte. If you trace the Blame back it attaches to #262 which as far as I know is now _layout.svelte.
The is_index route_suffix code looked somewhat relevant, but I didn't look deep enough to really understand it or whether it would complicate anything.

@nickreese
Copy link

What's blocking the merge on this? Would love to be able to use this functionality.

@Conduitry
Copy link
Member

This would be a breaking change, which can always be a bit of a merge delayer. It removes the ability to have spread routes that only match one or more segment. I don't know whether preserving that should be a goal in particular, and I don't know whether we want to try to instead solve this in a more unified way along with optional regular params.

@nickreese
Copy link

@Conduitry Got it. Thanks. I was actually looking for this to be implemented and commented on the wrong ticket. #545 Glad to see it was merged and working. :)

@Conduitry Conduitry closed this Feb 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants