Compare commits

...

3 Commits

Author SHA1 Message Date
Greg Johnston
27cddd7f3b remove log 2023-06-13 17:52:51 -04:00
Greg Johnston
ffc58d5dda cargo fmt 2023-06-13 17:51:13 -04:00
Greg Johnston
fd737caabd fix: <ErrorBoundary/> IDs with new hydration key system 2023-06-13 17:48:48 -04:00
2 changed files with 4 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
use crate::Children;
use leptos_dom::{Errors, IntoView};
use leptos_dom::{Errors, HydrationCtx, IntoView};
use leptos_macro::{component, view};
use leptos_reactive::{
create_rw_signal, provide_context, signal_prelude::*, RwSignal, Scope,
@@ -28,7 +28,7 @@ use leptos_reactive::{
/// }
/// # });
/// ```
#[component(transparent)]
#[component]
pub fn ErrorBoundary<F, IV>(
cx: Scope,
/// The components inside the tag which will get rendered
@@ -40,6 +40,7 @@ where
F: Fn(Scope, RwSignal<Errors>) -> IV + 'static,
IV: IntoView,
{
_ = HydrationCtx::next_component();
let errors: RwSignal<Errors> = create_rw_signal(cx, Errors::default());
provide_context(cx, errors);

View File

@@ -80,7 +80,7 @@ where
E: Error + Send + Sync + 'static,
{
fn into_view(self, cx: leptos_reactive::Scope) -> crate::View {
let id = ErrorKey(HydrationCtx::peek().id.to_string().into());
let id = ErrorKey(HydrationCtx::peek().fragment.to_string().into());
let errors = use_context::<RwSignal<Errors>>(cx);
match self {
Ok(stuff) => {