From 8bb509c166904eb356ef98afa519556a830fd977 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 18:12:38 +0530 Subject: [PATCH] fix: resolve 4 bugs in devtrack --- src/app/api/metrics/repo-analytics/route.ts | 2 +- src/app/compare/[users]/page.tsx | 2 ++ src/app/u/[username]/opengraph-image.tsx | 2 ++ src/app/u/[username]/page.tsx | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/api/metrics/repo-analytics/route.ts b/src/app/api/metrics/repo-analytics/route.ts index caf5e0946..a7a3fb6c4 100644 --- a/src/app/api/metrics/repo-analytics/route.ts +++ b/src/app/api/metrics/repo-analytics/route.ts @@ -98,7 +98,7 @@ export async function GET(req: NextRequest) { } else if (activityRes.ok) { const activityData = await activityRes.json(); if (Array.isArray(activityData) && activityData.length > 0) { - const lastWeek = activityData[activityData.length - 1]; + const lastWeek = activityData.at(-1); const days: number[] = lastWeek.days || []; // `lastWeek.week` is a Unix timestamp (seconds) for the Sunday that starts the bucket. // Derive labels from it so they always match the actual calendar days GitHub recorded. diff --git a/src/app/compare/[users]/page.tsx b/src/app/compare/[users]/page.tsx index fa4e35efe..280156d54 100644 --- a/src/app/compare/[users]/page.tsx +++ b/src/app/compare/[users]/page.tsx @@ -419,3 +419,5 @@ function ReposCard({ username, repos }: { username: string; repos: TopRepo[] }) ); } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file diff --git a/src/app/u/[username]/opengraph-image.tsx b/src/app/u/[username]/opengraph-image.tsx index 06afb7a0e..3f76f82ee 100644 --- a/src/app/u/[username]/opengraph-image.tsx +++ b/src/app/u/[username]/opengraph-image.tsx @@ -219,3 +219,5 @@ export default async function Image({ ); } } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file diff --git a/src/app/u/[username]/page.tsx b/src/app/u/[username]/page.tsx index e2f2dd718..247669961 100644 --- a/src/app/u/[username]/page.tsx +++ b/src/app/u/[username]/page.tsx @@ -710,3 +710,5 @@ function PublicTopRepos({ ); } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file