mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
fix: be ready to complete navigation immediately
This commit is contained in:
parent
c88409a333
commit
04f5207457
2 changed files with 10 additions and 3 deletions
|
@ -286,6 +286,9 @@ where
|
|||
let mut initial_state = state.borrow_mut();
|
||||
if url_snapshot.path() == initial_state.path {
|
||||
initial_state.url.set(url_snapshot.to_owned());
|
||||
if let Some(location) = location {
|
||||
location.ready_to_complete();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -304,6 +307,9 @@ where
|
|||
// if it's the same route, we just update the params
|
||||
if new_id == initial_state.id {
|
||||
initial_state.params.set(matched_params);
|
||||
if let Some(location) = location {
|
||||
location.ready_to_complete();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -377,7 +383,6 @@ where
|
|||
if let Some(location) = location {
|
||||
location.ready_to_complete();
|
||||
}
|
||||
|
||||
drop(old_owner);
|
||||
drop(old_params);
|
||||
drop(old_url);
|
||||
|
|
|
@ -119,10 +119,12 @@ impl LocationProvider for BrowserUrl {
|
|||
Self::complete_navigation(&loc);
|
||||
}
|
||||
let pending = Arc::clone(&pending);
|
||||
let (tx, rx) = oneshot::channel::<()>();
|
||||
if !same_path {
|
||||
*pending.lock().or_poisoned() = Some(tx);
|
||||
}
|
||||
async move {
|
||||
if !same_path {
|
||||
let (tx, rx) = oneshot::channel::<()>();
|
||||
*pending.lock().or_poisoned() = Some(tx);
|
||||
// if it has been canceled, ignore
|
||||
// otherwise, complete navigation -- i.e., set URL in address bar
|
||||
if rx.await.is_ok() {
|
||||
|
|
Loading…
Reference in a new issue