From 0a65f437893cb19a7b35dc642bacf1c28e2c1dd6 Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Wed, 26 Apr 2023 17:30:30 -0400 Subject: [PATCH] fix: `` toggling between states (closes issue #820) (#957) --- leptos/src/error_boundary.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/leptos/src/error_boundary.rs b/leptos/src/error_boundary.rs index e9639bd4a..b504fdeba 100644 --- a/leptos/src/error_boundary.rs +++ b/leptos/src/error_boundary.rs @@ -45,18 +45,20 @@ where provide_context(cx, errors); // Run children so that they render and execute resources - let children = children(cx); + let children = children(cx).into_view(cx); + let errors_empty = create_memo(cx, move |_| errors.with(Errors::is_empty)); move || { - match errors.with(Errors::is_empty) { - true => children.clone().into_view(cx), - false => view! { cx, + if errors_empty.get() { + children.clone().into_view(cx) + } else { + view! { cx, <> {fallback(cx, errors)} {children.clone()} } - .into_view(cx), + .into_view(cx) } } }