-
-
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
Encode Path Parameters in yew-router
#3187
Changes from 2 commits
1320c17
a1277fa
32f5fe0
b03b361
8c02048
07c0ccb
31ddfa7
905cb91
3aaea76
ef727b3
29f5439
39dd6b4
882c500
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ pub mod utils; | |
pub use routable::{AnyRoute, Routable}; | ||
pub use router::{BrowserRouter, HashRouter, Router}; | ||
pub use switch::Switch; | ||
pub use urlencoding::encode as encode_for_url; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be exposed via "macro_herlpers.rs". In addition, it might worth to test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that this should be exposed via macro_helpers and certainly not be a part of a public API. @Jaffa-Cakes please move it over to that file. I don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the primary performance hit when routes are switched comes from rendering components of the new page after the URL switch. I feel it might be worth to avoid the size increase here as we are looking at 5% increase of example sizes for the next release based on upcoming pull requests (e.g.: #3169, #3050) and the other size increases are not likely avoidable. But I don't have a high preference over either choice, so I am fine with proceeding with the Rust dependency as well. |
||
|
||
pub mod history { | ||
//! A module that provides universal session history and location information. | ||
|
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 have not got time to test this change, but I think this should not be applied on the remainder path matcher(*) which would otherwise escape the remainder path.
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've just done a quick test and it seems to work correctly in its current state when the link is generated and clicked.
Is this what you were concerned about failing?
Code
Result
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.
In route recognizer, you can construct a route like
/external/*remainder
(referred to as "named wildcards" in their documentation) which it will match both/external/a
and/external/a/b/c/d
and collectsa
anda/b/c/d
into the route parameter respectively.If we apply escaping to this, then we will not be able to construct routes like
/external/a/b/c/d
withLink
.See: https://docs.rs/route-recognizer/latest/route_recognizer/