feat: directly implement IntoView on resources on stable

This commit is contained in:
Greg Johnston 2024-04-09 14:45:01 -04:00
parent f0c1061161
commit 871d2c1b9f

View file

@ -45,7 +45,8 @@ use html::{AnyElement, ElementDescriptor};
pub use hydration::{HydrationCtx, HydrationKey};
#[cfg(not(feature = "nightly"))]
use leptos_reactive::{
MaybeProp, MaybeSignal, Memo, ReadSignal, RwSignal, Signal, SignalGet,
MaybeProp, MaybeSignal, Memo, ReadSignal, Resource, RwSignal, Signal,
SignalGet,
};
use leptos_reactive::{Oco, TextProp};
pub use macro_helpers::*;
@ -207,6 +208,20 @@ where
}
}
#[cfg(not(feature = "nightly"))]
impl<S, T> IntoView for Resource<S, T>
where
S: Clone,
T: IntoView + Clone,
{
#[cfg_attr(
any(debug_assertions, feature = "ssr"),
instrument(level = "trace", name = "Signal<T>", skip_all)
)]
fn into_view(self) -> View {
DynChild::new(move || self.get()).into_view()
}
}
#[cfg(not(feature = "nightly"))]
impl<T> IntoView for MaybeSignal<T>
where
T: IntoView + Clone,