From eea276ceb8569227ef86780dbfdf98793c5804e5 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:17:45 +0100 Subject: [PATCH 1/2] fix: fetch all homepage projects --- src/routes/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/routes/index.tsx b/src/routes/index.tsx index b3859bf..381d0b2 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -95,15 +95,16 @@ export default component$(() => { const homeDataSignal = useHomeData(); const homeData = homeDataSignal.value; - const allProjects = [ + const allProjects = useComputed$(() => [ ...(homeData.featured ? [homeData.featured] : []), ...(homeData.newAndShiny ?? []), ...(homeData.trendZone ?? []), ...(homeData.madeWithTailwind ?? []), - ]; - + ...(yourPicks.value ?? []), + ...(recentlyVisited.value ?? []), + ]); const projectIds = useComputed$(() => - allProjects.map((project) => project.$id) + allProjects.value.map((project) => project.$id) ); useUpvotes(projectIds); From 31d3be71abbfe1063026b233f3f36ffd2642a2d1 Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:19:26 +0100 Subject: [PATCH 2/2] fix: move execution order --- src/routes/index.tsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 381d0b2..82213d2 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -95,19 +95,6 @@ export default component$(() => { const homeDataSignal = useHomeData(); const homeData = homeDataSignal.value; - const allProjects = useComputed$(() => [ - ...(homeData.featured ? [homeData.featured] : []), - ...(homeData.newAndShiny ?? []), - ...(homeData.trendZone ?? []), - ...(homeData.madeWithTailwind ?? []), - ...(yourPicks.value ?? []), - ...(recentlyVisited.value ?? []), - ]); - const projectIds = useComputed$(() => - allProjects.value.map((project) => project.$id) - ); - useUpvotes(projectIds); - useVisibleTask$(async () => { account.value = await AppwriteService.getAccount(); }); @@ -143,6 +130,19 @@ export default component$(() => { ]); }); + const allProjects = useComputed$(() => [ + ...(homeData.featured ? [homeData.featured] : []), + ...(homeData.newAndShiny ?? []), + ...(homeData.trendZone ?? []), + ...(homeData.madeWithTailwind ?? []), + ...(yourPicks.value ?? []), + ...(recentlyVisited.value ?? []), + ]); + const projectIds = useComputed$(() => + allProjects.value.map((project) => project.$id) + ); + useUpvotes(projectIds); + return ( <>