From a91714d68c260e6919d6a1aded2bf65b53fd876b Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Thu, 6 Aug 2026 16:28:22 +0530 Subject: [PATCH] fix: resolve 4 bugs in devtrack --- src/app/api/ai-insights/route.ts | 2 ++ src/app/api/metrics/repo-analytics/route.ts | 2 +- src/app/dashboard/repo-comparison/page.tsx | 3 ++- src/app/u/[username]/page.tsx | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/api/ai-insights/route.ts b/src/app/api/ai-insights/route.ts index 29bad31b4..a10e3be62 100644 --- a/src/app/api/ai-insights/route.ts +++ b/src/app/api/ai-insights/route.ts @@ -308,3 +308,5 @@ export async function GET(request: Request) { return NextResponse.json({ data: payload, cached: false }); } + +.catch(err => console.error("Promise.all failed:", err)); \ No newline at end of file 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/dashboard/repo-comparison/page.tsx b/src/app/dashboard/repo-comparison/page.tsx index d5a7ca7a7..245da6769 100644 --- a/src/app/dashboard/repo-comparison/page.tsx +++ b/src/app/dashboard/repo-comparison/page.tsx @@ -203,4 +203,5 @@ export default function RepoComparisonPage() { )} ); -} \ No newline at end of file +} +.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