-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix : TODO the AllowMissing shim doesn't appear to offer much over Permissive. #1259
Conversation
yew-router/src/switch.rs
Outdated
/// Allows a section to match, providing a None value, | ||
/// if its contents are entirely missing, or starts with a '/'. | ||
/// if its contents are entirely missing, or ends with a '/' without any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure what without any
refers to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the contents without any.
Sorry, I'm not a native.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's no problem!
I just want to make it clear for people who stumble across this in the future :)
Do you mean that there's nothing after the slash (i.e. /
but not /<something here>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// if its contents are entirely missing, or ends with a '/' without any. | |
/// if it doesn't have any contents, or is a pure path (i.e. doesn't have any query strings such as `?b=1` or fragments such as `#fragment`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it's more readable now.
Probably matches
would be better than characters
because there's a case like /#
which also ends as AllowMissing(None)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or matched characters
would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps mentioning which characters don't count?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, cases like #a=1
and ?b=1
would also be ignore. There are just too many cases that could be ignored.
Besides, this chracter matching is what matcher
part of code does.
Too much information on another file would make people confused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.
@chidea I personally feel that there shouldn't be a distinction between
And
I think it requires a big rethinking of the |
@siku2 do you have any thoughts here? I'm thinking we could start a new project board for router improvements, it needs some love in my opinion |
This work could be captured by #1107 |
@jstarry I've spotted a lot of things in yew-router that could be improved. Adding a new project board makes sense! |
Awesome, here it is: https://github.com/yewstack/yew/projects/11 |
AllowMissing
might be different fromPermissive
on special match cases "" and "/" but be the same on others.This PR is making it return
AllowMissing(None)
on these special cases andAllowMissing(Some(_))
on others.Some test cases are given to assert that both
AllowMissing
andPermissive
act the same or the different correctly on some match cases.A probable misinformation in the documentation of
AllowMissing
is also corrected.