From 0a9543cd556f760e2b6fe356cb7a31ffe773d0a1 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Sun, 2 Aug 2026 16:21:23 +0530 Subject: [PATCH 1/3] fix: code quality and safety improvements --- src/app/api/goals/route.ts | 2 +- src/components/GoalTracker.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/goals/route.ts b/src/app/api/goals/route.ts index 0d616ebd3..b4b83346b 100644 --- a/src/app/api/goals/route.ts +++ b/src/app/api/goals/route.ts @@ -239,7 +239,7 @@ try { let safeDeadline: string | null = null; if (typeof deadline === "string") { const d = new Date(deadline); - if (!isNaN(d.getTime())) { + if (!Number.isNaN(d.getTime())) { d.setUTCHours(23, 59, 59, 999); safeDeadline = d.toISOString(); } diff --git a/src/components/GoalTracker.tsx b/src/components/GoalTracker.tsx index d2eecbe22..a643a64f6 100644 --- a/src/components/GoalTracker.tsx +++ b/src/components/GoalTracker.tsx @@ -1064,7 +1064,7 @@ function ConfettiBurst() { id: i, x: Math.cos(angle) * distance, y: Math.sin(angle) * distance - 20, - color: colors[Math.random() * colors.length | 0], + color: colors[Math.floor(Math.random() * colors.length) | 0], rot: Math.random() * 360 + 180, scale: 0.5 + Math.random() * 0.7, speed: 0.8 + Math.random() * 0.6, From 363a05c76d3ac27c86738d3516418cc4206bdb93 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 3 Aug 2026 00:49:52 +0530 Subject: [PATCH 2/3] fix: additional real bug fixes --- src/app/api/goals/route.ts | 2 +- src/components/GoalTracker.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/goals/route.ts b/src/app/api/goals/route.ts index b4b83346b..84218a34a 100644 --- a/src/app/api/goals/route.ts +++ b/src/app/api/goals/route.ts @@ -177,7 +177,7 @@ export async function GET() { } } - const goalsWithHistory = processedGoals.map((goal) => ({ + const goalsWithHistory = (processedGoals ?? []).map((goal) => ({ ...goal, last_period: latestHistoryByGoal.get(goal.id) ?? null, })); diff --git a/src/components/GoalTracker.tsx b/src/components/GoalTracker.tsx index a643a64f6..17d6a1c0c 100644 --- a/src/components/GoalTracker.tsx +++ b/src/components/GoalTracker.tsx @@ -429,7 +429,7 @@ export default function GoalTracker() { const data: { goal: Goal } = await response.json(); setGoals((currentGoals) => - currentGoals.map((goal) => (goal.id === data.goal.id ? data.goal : goal)) + (currentGoals ?? []).map((goal) => (goal.id === data.goal.id ? data.goal : goal)) ); } catch { setShareError("Failed to update goal sharing. Please check your connection."); From 47446ece8476f86b86515ba7e088600612bcddd9 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar Bajpai Date: Mon, 3 Aug 2026 00:51:04 +0530 Subject: [PATCH 3/3] fix: additional real bug fixes --- src/components/GoalTracker.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/GoalTracker.tsx b/src/components/GoalTracker.tsx index 17d6a1c0c..51a010c77 100644 --- a/src/components/GoalTracker.tsx +++ b/src/components/GoalTracker.tsx @@ -586,7 +586,7 @@ export default function GoalTracker() { > All - {CATEGORY_OPTIONS.map((c) => ( + {(CATEGORY_OPTIONS ?? []).map((c) => (