debounced on_scroll_end in use_scroll now uses try_get_untracked in case the context has been destroyed before it is called.

Fixes #51
This commit is contained in:
Maccesch 2023-11-15 23:57:17 +00:00
parent 2d65c60bf1
commit b7a3ac554b

View file

@ -257,7 +257,7 @@ where
let on_stop = Rc::clone(&options.on_stop);
move |e| {
if !is_scrolling.get_untracked() {
if !is_scrolling.try_get_untracked().unwrap_or_default() {
return;
}
@ -390,12 +390,7 @@ where
Signal<Option<web_sys::EventTarget>>,
web_sys::EventTarget,
_,
>(
target,
ev::scroll,
handler,
options.event_listener_options,
);
>(target, ev::scroll, handler, options.event_listener_options);
} else {
let _ = use_event_listener_with_options::<
_,