From 80cd26aa28e12f22c35ba5a09655d2726f715669 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 21:22:18 +1200 Subject: [PATCH] Minor fixes to feed state manangement --- materialious/src/routes/(app)/+page.svelte | 3 ++- materialious/src/routes/(app)/+page.ts | 1 - materialious/src/routes/(app)/subscriptions/+page.svelte | 6 ++---- materialious/src/routes/(app)/subscriptions/+page.ts | 6 +----- materialious/src/routes/(app)/trending/+page.svelte | 5 ++--- materialious/src/routes/(app)/trending/+page.ts | 2 -- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/materialious/src/routes/(app)/+page.svelte b/materialious/src/routes/(app)/+page.svelte index 50ef53fa..3f6015e1 100644 --- a/materialious/src/routes/(app)/+page.svelte +++ b/materialious/src/routes/(app)/+page.svelte @@ -1,5 +1,6 @@ @@ -11,5 +12,5 @@

Popular page has been disabled

{:else} - + {/if} diff --git a/materialious/src/routes/(app)/+page.ts b/materialious/src/routes/(app)/+page.ts index 5045ff65..37b3ed62 100644 --- a/materialious/src/routes/(app)/+page.ts +++ b/materialious/src/routes/(app)/+page.ts @@ -24,7 +24,6 @@ export async function load() { } return { - popular: popular, popularDisabled: popularDisabled }; } diff --git a/materialious/src/routes/(app)/subscriptions/+page.svelte b/materialious/src/routes/(app)/subscriptions/+page.svelte index c4042a56..47c5ed03 100644 --- a/materialious/src/routes/(app)/subscriptions/+page.svelte +++ b/materialious/src/routes/(app)/subscriptions/+page.svelte @@ -6,10 +6,8 @@ import { _ } from 'svelte-i18n'; import InfiniteLoading, { type InfiniteEvent } from 'svelte-infinite-loading'; - let { data } = $props(); - let currentPage = 1; - let videos: (VideoBase | Video | PlaylistPageVideo)[] = $state(data.videos); + let videos: (VideoBase | Video | PlaylistPageVideo)[] = $state($feedCacheStore.subscription); async function loadMore(event: InfiniteEvent) { currentPage++; @@ -32,6 +30,6 @@ - + diff --git a/materialious/src/routes/(app)/subscriptions/+page.ts b/materialious/src/routes/(app)/subscriptions/+page.ts index 0f042c53..48b7fdce 100644 --- a/materialious/src/routes/(app)/subscriptions/+page.ts +++ b/materialious/src/routes/(app)/subscriptions/+page.ts @@ -20,11 +20,7 @@ export async function load() { } else { await getFeed(100, 1).then((feeds) => { const newVideos = [...feeds.notifications, ...feeds.videos]; - feedCacheStore.set({ subscription: { ...Array.from(new Set(newVideos)), ...videos } }); + feedCacheStore.set({ subscription: Array.from(new Set({ ...newVideos, ...videos })) }); }); } - - return { - videos: videos - }; } diff --git a/materialious/src/routes/(app)/trending/+page.svelte b/materialious/src/routes/(app)/trending/+page.svelte index be94a542..0ab8e773 100644 --- a/materialious/src/routes/(app)/trending/+page.svelte +++ b/materialious/src/routes/(app)/trending/+page.svelte @@ -1,7 +1,6 @@ - + diff --git a/materialious/src/routes/(app)/trending/+page.ts b/materialious/src/routes/(app)/trending/+page.ts index 5e032f8e..252f2de0 100644 --- a/materialious/src/routes/(app)/trending/+page.ts +++ b/materialious/src/routes/(app)/trending/+page.ts @@ -17,6 +17,4 @@ export async function load() { } else { getTrending().then((newTrending) => feedCacheStore.set({ trending: newTrending })); } - - return { trending: trending }; }