mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
fix: <ErrorBoundary/>
IDs with new hydration key system (#1180)
This commit is contained in:
parent
2b7923261b
commit
a98885a123
2 changed files with 4 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue