-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Questions about the catch all syntax #1586
Labels
docs
Concerns the documentation content or the documentation website
Comments
Alternatively we could consider keeping the syntactic sugar |
posva
added
the
docs
Concerns the documentation content or the documentation website
label
Oct 21, 2022
posva
changed the title
Improve Vue3 Router catch all documentation is confusing
Questions about the catch all syntax
Oct 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What problem does this feature solve?
The documentation regarding catch-all routes can be improved. Specifically the section describing why the catch all parameter should be repeatable. Also, the suggested example parameter name "pathMatch" is a little generic and confusing. The term does not build any immediate intuition for people coming into a new project that the route is a catch all.
What does the proposed API look like?
Improving "pathMatch" example parameter
I'm sure others have better ideas to improve "pathMatch" as the suggested catch all parameter name. "Match" is implied because it wouldn't be captured if it wasn't a match, so I suggest "Match" be removed. To make it more clear we could use "completePath", "catchAllPath", "anyPath" or even just "path" for the example without repeating. For the example with repeating we could use "pathPart" or something.
Clarifying the motivation and recommendation to repeat
Regarding the recommendation of making the catch all parameter repeatable. If the regex matches "anything" not just any chars between "/", this is not clear. We could change "anything" to be "anything including slashes" to make that more obvious.
The justification is also confusing for two reasons.
First, why would making a param repeatable make a "." regex not match slashes? That seems counter intuitive because "." regex matches slashes. It also looks strange because the "*" and "?" are reused out of a regex context. but perhaps that is just an artifact of the api.
Second, why is this array preferable for programmatic navigation, can we can just navigating using fullPath instead of reconstituting the parameters? Also not sure when the need for programmatic navigation from a 404 or match all route come up.
Thank for you reviewing. I may have misunderstood the documentation, but I hope the issue it motivates one or two small changes to improve that section's clarity.
The text was updated successfully, but these errors were encountered: