mirror of
https://github.com/adoyle0/leptos-use.git
synced 2025-03-13 01:09:48 -04:00
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:
parent
2d65c60bf1
commit
b7a3ac554b
1 changed files with 2 additions and 7 deletions
|
@ -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::<
|
||||
_,
|
||||
|
|
Loading…
Add table
Reference in a new issue