From eed49795d2086e5bc77b3fea63e8ba1fcf717ec7 Mon Sep 17 00:00:00 2001 From: aumetra Date: Sun, 15 Oct 2023 20:24:10 +0200 Subject: [PATCH] fix infinite scroll --- kitsune-fe/src/graphql/timeline.ts | 2 +- kitsune-fe/src/views/timeline/FederatedPage.vue | 4 +--- kitsune-fe/src/views/timeline/HomePage.vue | 4 +--- kitsune-fe/src/views/timeline/LocalPage.vue | 4 +--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/kitsune-fe/src/graphql/timeline.ts b/kitsune-fe/src/graphql/timeline.ts index 288eae34d..b1533ed92 100644 --- a/kitsune-fe/src/graphql/timeline.ts +++ b/kitsune-fe/src/graphql/timeline.ts @@ -37,7 +37,7 @@ function getHome(after: Ref) { } `), variables: { - after: after as unknown as string, + after: after as unknown as string, // Weird cast to allow reactivity }, }); diff --git a/kitsune-fe/src/views/timeline/FederatedPage.vue b/kitsune-fe/src/views/timeline/FederatedPage.vue index 9835e2da0..b12ac2c61 100644 --- a/kitsune-fe/src/views/timeline/FederatedPage.vue +++ b/kitsune-fe/src/views/timeline/FederatedPage.vue @@ -15,9 +15,7 @@ const localTimelineQuery = getPublic(lastPostId, false); watch(localTimelineQuery, (newTimelineQuery) => { - (newTimelineQuery?.publicTimeline.nodes ?? []).forEach((post) => - posts.value.push(post), - ); + posts.value = newTimelineQuery?.publicTimeline.nodes ?? []; }); async function loadMore(): Promise { diff --git a/kitsune-fe/src/views/timeline/HomePage.vue b/kitsune-fe/src/views/timeline/HomePage.vue index 3abcddcfc..d743f8e2c 100644 --- a/kitsune-fe/src/views/timeline/HomePage.vue +++ b/kitsune-fe/src/views/timeline/HomePage.vue @@ -15,9 +15,7 @@ const homeTimelineQuery = getHome(lastPostId); watch(homeTimelineQuery, (newTimelineQuery) => { - (newTimelineQuery?.homeTimeline.nodes ?? []).forEach((post) => - posts.value.push(post), - ); + posts.value = newTimelineQuery?.homeTimeline.nodes ?? []; }); async function loadMore(): Promise { diff --git a/kitsune-fe/src/views/timeline/LocalPage.vue b/kitsune-fe/src/views/timeline/LocalPage.vue index 363d46428..18846c05f 100644 --- a/kitsune-fe/src/views/timeline/LocalPage.vue +++ b/kitsune-fe/src/views/timeline/LocalPage.vue @@ -15,9 +15,7 @@ const localTimelineQuery = getPublic(lastPostId, true); watch(localTimelineQuery, (newTimelineQuery) => { - (newTimelineQuery?.publicTimeline.nodes ?? []).forEach((post) => - posts.value.push(post), - ); + posts.value = newTimelineQuery?.publicTimeline.nodes ?? []; }); async function loadMore(): Promise {