mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
let ErrorBoundary own the fallback
This commit is contained in:
parent
9bab4da172
commit
21dd7e9c76
2 changed files with 3 additions and 4 deletions
|
@ -2,7 +2,7 @@ use lazy_static::lazy_static;
|
|||
use leptos::{
|
||||
component, prelude::*, reactive_graph::computed::AsyncDerived, server,
|
||||
server::Resource, server_fn::ServerFnError, suspend, view, ErrorBoundary,
|
||||
IntoView, Params, Suspense, Suspend
|
||||
IntoView, Params, Suspend, Suspense,
|
||||
};
|
||||
use leptos_meta::*;
|
||||
use leptos_router::{
|
||||
|
@ -119,7 +119,6 @@ fn Post() -> impl IntoView {
|
|||
<em>"The world's best content."</em>
|
||||
<Suspense fallback=move || view! { <p>"Loading post..."</p> }>
|
||||
<ErrorBoundary fallback=|errors| {
|
||||
let errors = errors.clone();
|
||||
view! {
|
||||
<div class="error">
|
||||
<h1>"Something went wrong."</h1>
|
||||
|
|
|
@ -47,7 +47,7 @@ pub fn ErrorBoundary<FalFn, Fal, Chil>(
|
|||
fallback: FalFn,
|
||||
) -> impl IntoView
|
||||
where
|
||||
FalFn: FnMut(&ArcRwSignal<Errors>) -> Fal + Clone + Send + 'static,
|
||||
FalFn: FnMut(ArcRwSignal<Errors>) -> Fal + Clone + Send + 'static,
|
||||
Fal: IntoView + 'static,
|
||||
Chil: IntoView + 'static,
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ where
|
|||
boundary_id: boundary_id.clone(),
|
||||
errors_empty: errors_empty.get(),
|
||||
children: children.take(),
|
||||
fallback: Some((fallback.clone())(&errors)),
|
||||
fallback: Some((fallback.clone())(errors.clone())),
|
||||
errors: errors.clone(),
|
||||
rndr: PhantomData,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue