Hi, thanks for this library. I can't seem to get use_raf_fn working correctly, however.
panicked at /home/francis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos-use-0.10.10/src/use_raf_fn.rs:92:27:
Attempted to get a signal after it was disposed.
signal created here: /home/francis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos-use-0.10.10/src/use_raf_fn.rs:55:35
warning happened here: /home/francis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptos-use-0.10.10/src/use_raf_fn.rs:92:27
Looking at the referenced lines it's because in the loop_fn this signal is being accessed:
if !is_active.get_untracked() {
return;
}
but I suppose it's after the hosting component goes away, and the RAF function is called once more afterwards.
I thought the lines:
let pause = move || {
set_active.set(false);
let handle = raf_handle.get();
if let Some(handle) = handle {
let _ = window().cancel_animation_frame(handle);
}
raf_handle.set(None);
};
on_cleanup(pause.clone());
would stop the handler in time but I guess not? Or perhaps I'm overlooking something?
Hi, thanks for this library. I can't seem to get
use_raf_fn
working correctly, however.Looking at the referenced lines it's because in the
loop_fn
this signal is being accessed:but I suppose it's after the hosting component goes away, and the RAF function is called once more afterwards.
I thought the lines:
would stop the handler in time but I guess not? Or perhaps I'm overlooking something?
thank you.