fix: missing ? in navigation now that removed (#1092)

This commit is contained in:
Greg Johnston 2023-05-24 12:12:57 -04:00 committed by GitHub
parent 06d28f7d67
commit 7f14da3026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 5 deletions

View file

@ -134,8 +134,14 @@ where
request_animation_frame(move || {
if let Err(e) = navigate(
&format!(
"{}{}",
url.pathname, url.search,
"{}{}{}",
url.pathname,
if url.search.is_empty() {
""
} else {
"?"
},
url.search,
),
Default::default(),
) {
@ -190,8 +196,14 @@ where
request_animation_frame(move || {
if let Err(e) = navigate(
&format!(
"{}{}",
url.pathname, url.search,
"{}{}{}",
url.pathname,
if url.search.is_empty() {
""
} else {
"?"
},
url.search,
),
Default::default(),
) {

View file

@ -385,7 +385,10 @@ impl RouterContextInner {
return;
}
let to = path_name + &unescape(&url.search) + &unescape(&url.hash);
let to = path_name
+ if url.search.is_empty() { "" } else { "?" }
+ &unescape(&url.search)
+ &unescape(&url.hash);
let state =
leptos_dom::helpers::get_property(a.unchecked_ref(), "state")
.ok()