mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
fix: only run Suspense on the condition in ProtectedRoute (closes #2798)
This commit is contained in:
parent
f7053ac960
commit
f1fae63064
1 changed files with 5 additions and 2 deletions
|
@ -331,12 +331,15 @@ where
|
|||
(view! {
|
||||
<Transition>
|
||||
{move || {
|
||||
match condition() {
|
||||
let condition = condition();
|
||||
let view = view.clone();
|
||||
let redirect_path = redirect_path.clone();
|
||||
Unsuspend::new(move || match condition {
|
||||
Some(true) => Either::Left(view()),
|
||||
#[allow(clippy::unit_arg)]
|
||||
Some(false) => Either::Right(view! { <Redirect path=redirect_path()/> }),
|
||||
None => Either::Right(()),
|
||||
}
|
||||
})
|
||||
}}
|
||||
|
||||
</Transition>
|
||||
|
|
Loading…
Reference in a new issue