removed double call of infinite scroll callback

Fixes #50
This commit is contained in:
Maccesch 2023-11-15 23:45:51 +00:00
parent 09182c5ee9
commit 2d65c60bf1
3 changed files with 10 additions and 3 deletions

View file

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixes 🍕 ### Fixes 🍕
- `use_raf_fn` and `use_timestamp` no longer spam warnings because of `get`ting signals outside of reactive contexts. - `use_raf_fn` and `use_timestamp` no longer spam warnings because of `get`ting signals outside of reactive contexts.
- `use_infinite_scroll` no longer calls the callback twice for the same event
## [0.8.2] - 2023-11-09 ## [0.8.2] - 2023-11-09

View file

@ -27,11 +27,11 @@ prost = { version = "0.12", optional = true }
serde = { version = "1", optional = true } serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true } serde_json = { version = "1", optional = true }
thiserror = "1.0" thiserror = "1.0"
wasm-bindgen = "0.2.87" wasm-bindgen = "0.2.88"
wasm-bindgen-futures = "0.4" wasm-bindgen-futures = "0.4"
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3" version = "0.3.65"
features = [ features = [
"AddEventListenerOptions", "AddEventListenerOptions",
"BinaryType", "BinaryType",

View file

@ -186,7 +186,13 @@ where
let _ = watch( let _ = watch(
move || state.arrived_state.get().get_direction(direction), move || state.arrived_state.get().get_direction(direction),
move |_, _, _| { move |arrived, prev_arrived, _| {
if let Some(prev_arrived) = prev_arrived {
if prev_arrived == arrived {
return;
}
}
check_and_load check_and_load
.get_value() .get_value()
.expect("check_and_load is set above")() .expect("check_and_load is set above")()