Skip to content

Commit

Permalink
Update ComposeRef to Leptos 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Almaju committed Jan 19, 2025
1 parent 5393a88 commit 17f3d1b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"packages/primitives/leptos/accessible-icon",
"packages/primitives/leptos/arrow",
"packages/primitives/leptos/aspect-ratio",
"packages/primitives/leptos/compose-refs",
"packages/primitives/leptos/direction",
"packages/primitives/leptos/id",
"packages/primitives/leptos/label",
Expand Down
9 changes: 6 additions & 3 deletions packages/primitives/leptos/compose-refs/src/compose_refs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use leptos::{html::ElementDescriptor, Effect, NodeRef};
use leptos::web_sys::Element;
use leptos::{html::ElementType, prelude::*, tachys::html::node_ref::NodeRefContainer};

fn compose_refs<T: ElementDescriptor + Clone + 'static>(refs: Vec<NodeRef<T>>) -> NodeRef<T> {
fn compose_refs<T: ElementType<Output = Element> + Clone + 'static>(
refs: Vec<NodeRef<T>>,
) -> NodeRef<T> {
let composed_ref = NodeRef::new();

Effect::new(move |_| {
Expand All @@ -14,7 +17,7 @@ fn compose_refs<T: ElementDescriptor + Clone + 'static>(refs: Vec<NodeRef<T>>) -
composed_ref
}

pub fn use_composed_refs<T: ElementDescriptor + Clone + 'static>(
pub fn use_composed_refs<T: ElementType<Output = Element> + Clone + 'static>(
refs: Vec<NodeRef<T>>,
) -> NodeRef<T> {
compose_refs(refs)
Expand Down

0 comments on commit 17f3d1b

Please sign in to comment.