fix: only run Suspense on the condition in ProtectedRoute (closes #2798)

This commit is contained in:
Greg Johnston 2024-08-08 13:57:58 -04:00
parent f7053ac960
commit f1fae63064

View file

@ -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>