fix(web): preload even on first load, stop if over

This commit is contained in:
əlemi 2024-05-29 18:06:47 +02:00
parent 40dc245680
commit 32ce9391a4
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -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);
}
},