Skip to content

Commit

Permalink
feat: directly implement IntoView on resources on stable
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Apr 9, 2024
1 parent f0c1061 commit 871d2c1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion leptos_dom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 871d2c1

Please sign in to comment.