Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jetli committed Mar 5, 2024
1 parent 0f01abc commit 6814f69
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/yew-hooks/src/hooks/use_visible.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::use_effect_once;
use wasm_bindgen::{closure::Closure, JsCast};
use web_sys::{IntersectionObserver, IntersectionObserverEntry};
use yew::{functional::*, NodeRef};
use yew::prelude::*;

use super::use_effect_once;

#[hook]
/// Check if an element is visible. Internally, it uses an [`IntersectionObserver`] to receive
Expand Down Expand Up @@ -55,9 +56,9 @@ pub fn use_visible(node: NodeRef, sticky: bool) -> bool {
},
)
.into_js_value();
let observer = IntersectionObserver::new(&closure.dyn_ref().unwrap()).unwrap();
let observer = IntersectionObserver::new(closure.dyn_ref().unwrap()).unwrap();
if let Some(node) = node.get() {
observer.observe(&node.dyn_ref().unwrap());
observer.observe(node.dyn_ref().unwrap());
}
move || observer.disconnect()
});
Expand Down

0 comments on commit 6814f69

Please sign in to comment.