From 32ce9391a45c78c73fc016cfe8fe64614a628b3c Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 29 May 2024 18:06:47 +0200 Subject: [PATCH] fix(web): preload even on first load, stop if over --- web/src/components/timeline.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/src/components/timeline.rs b/web/src/components/timeline.rs index bd3d4b14..b5e1b509 100644 --- a/web/src/components/timeline.rs +++ b/web/src/components/timeline.rs @@ -37,7 +37,8 @@ impl Timeline { } pub fn more(&self, auth: Auth) { - if self.loading.get() { return } + if self.loading.get_untracked() { return } + if self.over.get_untracked() { return } let _self = *self; spawn_local(async move { _self.loading.set(true); @@ -150,8 +151,8 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView { let _auto_loader = create_local_resource( move || (scroll_debounced.get(), height.get()), move |(s, h)| async move { - if !config.get().infinite_scroll { return } - if s > 0.0 && h - s < view_height && !tl.loading.get() { + if !config.get_untracked().infinite_scroll { return } + if h - s < view_height { tl.more(auth); } },