mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-12 23:57:09 +00:00
fix: <Redirect/>
between nested routes at same level (#767)
This commit is contained in:
parent
97bbdf561a
commit
f42568d262
1 changed files with 8 additions and 3 deletions
|
@ -34,10 +34,15 @@ where
|
||||||
if let Some(redirect_fn) = use_context::<ServerRedirectFunction>(cx) {
|
if let Some(redirect_fn) = use_context::<ServerRedirectFunction>(cx) {
|
||||||
(redirect_fn.f)(&path);
|
(redirect_fn.f)(&path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect on the client
|
// redirect on the client
|
||||||
let navigate = use_navigate(cx);
|
else {
|
||||||
navigate(&path, options.unwrap_or_default())
|
let navigate = use_navigate(cx);
|
||||||
|
leptos::request_animation_frame(move || {
|
||||||
|
if let Err(e) = navigate(&path, options.unwrap_or_default()) {
|
||||||
|
leptos::error!("<Redirect/> error: {e:?}");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wrapping type for a function provided as context to allow for
|
/// Wrapping type for a function provided as context to allow for
|
||||||
|
|
Loading…
Reference in a new issue