Skip to content
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

Prefix to slugs / more flexible path parsing #101

Open
asprionj opened this issue Nov 22, 2022 · 1 comment
Open

Prefix to slugs / more flexible path parsing #101

asprionj opened this issue Nov 22, 2022 · 1 comment

Comments

@asprionj
Copy link

Problem: I want do discern between two different components based on a prefix of an ID:

/group1/group1-1 -> view this group of things (e.g. a list)
/group1/element001 -> view/edit details of an element

Is there already a way of doing this? I tried to abuse nested <Route>s (outer with path="/group1/group*", inner with path=":id") but that did not work (no error, but neither a match for an according URI).

I want to strictly separate concerns, i.e. not parse parts of the path in a component and then display the correct content.

A simple (and completely flexible) solution could be to allow specification of an arbitrary function that gets the (remaining) path (or a matched slug or the contents of a wildcard), and returns a component and the params.

@the-eater
Copy link

maybe a bit of a necro, but I added prefix support here for myself here, 027e40b

I am unsure if there's actual interest in it however

(notation is ^<prefix>:<var name>, which seemed the most intuitive solution to me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants