fix: timing update on timeline fetcher

This commit is contained in:
mae taylor 2025-07-15 16:42:21 +01:00
parent 3b8ca902f1
commit ea1a492dc0
Signed by: mae
GPG key ID: 3C80D76BA7A3B9BD
3 changed files with 10 additions and 8 deletions

View file

@ -16,8 +16,10 @@ export async function getTimeline(timelineType = "home", clean, localOnly = fals
if (loading) return; // no spamming!! if (loading) return; // no spamming!!
loading = true; loading = true;
// if (!clean && get(timeline).length > 0) if(clean) {
// last_post = get(timeline)[get(timeline).length - 1].id; timeline.set([]);
last_post = false;
}
let timeline_data; let timeline_data;
switch(timelineType) { switch(timelineType) {
@ -47,10 +49,7 @@ export async function getTimeline(timelineType = "home", clean, localOnly = fals
return; return;
} }
if (clean) { if (!clean) {
timeline.set([]);
last_post = false;
} else {
last_post = timeline_data.next.url.searchParams.get("max_id") last_post = timeline_data.next.url.searchParams.get("max_id")
} }

View file

@ -124,7 +124,10 @@
</Button> </Button>
<div class="flex-row"> <div class="flex-row">
<Button centered label="{lang.string('navigation.favourites')}" disabled> <Button centered
label="{lang.string('navigation.favourites')}"
href="/favourites"}
active={$page.url.pathname === "/favourites"}>
<svelte:fragment slot="icon"> <svelte:fragment slot="icon">
<FavouritesIcon/> <FavouritesIcon/>
</svelte:fragment> </svelte:fragment>

View file

@ -12,7 +12,7 @@
const lang = Lang(); const lang = Lang();
if (!$account) goto("/"); if (!$account) goto("/");
getTimeline("favourites"); getTimeline("favourites", true);
document.addEventListener('scroll', () => { document.addEventListener('scroll', () => {
if ($account && $page.url.pathname !== "/favourites") return; if ($account && $page.url.pathname !== "/favourites") return;