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

feat: add [retrieve or check getter function] to/in [fast-router] #6083

Open
hajo-travanto opened this issue Jun 8, 2022 · 2 comments
Open
Labels
area:fast-router Pertains to fast-router community:request Issues specifically reported by a member of the community. feature A new feature status:under-consideration Issue is being reviewed by the team.
Milestone

Comments

@hajo-travanto
Copy link

🙋 Feature Request

The Router object currently only supports adding and replacing content, but not listing or checking if a path or name is matching something that has been defined earlier

🤔 Expected Behavior

There could be something like a Route.path/name.check or Route.path/name.list functionality so that it will be possible to check for existing routes when needed

😯 Current Behavior

There is no possibility to read or get data from the Router object

💁 Possible Solution

See expected behavior

🔦 Context

At the moment i am using manually created whitelists to determine which path/name is allowed before linking or even forwarding the URL to it, because sometimes internal links might either be broken, target an unintended area or are not accessible for the active RBAC settings. So it is generally helpful if the active router setup can be checked or validated in some way.

💻 Examples

There is e.g. a forwarding functionality with Route.path.push, but depending on the circumstances and router setup the target URL will vary.

@hajo-travanto hajo-travanto added the status:triage New Issue - needs triage label Jun 8, 2022
@EisenbergEffect EisenbergEffect added feature A new feature status:under-consideration Issue is being reviewed by the team. community:request Issues specifically reported by a member of the community. area:fast-router Pertains to fast-router and removed status:triage New Issue - needs triage labels Jun 10, 2022
@EisenbergEffect EisenbergEffect added this to the Router 1.0 milestone Jun 10, 2022
@EisenbergEffect
Copy link
Contributor

@hjp-work Something that would really help would be a kind of code sample. Imagine that the API you want already exists, could you show me a sample bit of code for how you would use it so I can understand the use case better?

@hajo-travanto
Copy link
Author

I created an example with a recipe list where some have a special subpage with additional information. It is not completly working, but i hope you are able to get the idea behind it. Otherwise i'll try to improve the example or create another one:

https://stackblitz.com/edit/typescript-ndlduu?file=index.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:fast-router Pertains to fast-router community:request Issues specifically reported by a member of the community. feature A new feature status:under-consideration Issue is being reviewed by the team.
Projects
Status: Triage
Development

No branches or pull requests

2 participants