-
-
Notifications
You must be signed in to change notification settings - Fork 658
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 square brackets for advanced dynamic path segments (prefix, suffix & multiple) #2734
base: main
Are you sure you want to change the base?
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 77bf7fb. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
As we will also add optional path params we must check whether this can be decoupled or not, especially when it comes to types. @chorobin let's discuss this |
@schiller-manuel interesting I see 🤔 yea would of course be nice if everything would work properly together 🤞 just pushed an improvement so routes should be better sorted now to address the last part of my initial comment. Also not sure breaking routing completely is desirable 😅 tho would it be helpful to drop |
we will definitely not introduce a breaking API change in v1 by removing support for $ |
Yea totally understand just wanted to've mentioned it 😇 |
What could I do to potentially help move this forward? |
first, we need to define the full set of features we want to support with path params (and maybe other related features that would be influenced by it such as parallel routes ) so we can solve this holistically. so you could open up an RFC style discussion to get this started. |
Opened the RFC as WIP to get started #2800 |
Hey, this is my take so far on #707 inspired by #709
Also tried my luck making it type safe, mostly ChatGPT tho and I'm actually not completely sure it works 😬 but I think it's a good enough start to open a PR, as I'd love prefixes to be officially supported 😇
I'm very curious what the team thinks about this approach, for explanation, I decided to not stick to
$
because having start[
and end]
properly delimited make suffixes and even multiple dynamic params easier or even possible. Also as mentioned before in #707 (comment) SvelteKit, Rakkas and possibly others already use square brackets, tho I'm curious if there's potential downsides?So this PR should make the following possible:
prefix:
@[username]
suffix:
[username]@
both:
@[username]@
where
@
could of course be anythingmultiple:
[firstname]-[lastname]
What I think might be nice for multiple params, would be better matching so that it could properly distinguish/handleshould be fixed now[firstname]-[lastname]
and[firstname]-[middlename]-[lastname]
which it doesn't yet, so currently the first route would also handle the second and the second would never match. 😅Closes: #707