Skip to content

Commit a11082d

Browse files
author
Saurabh Kumar Bajpai
committed
fix: additional real bug fixes
1 parent 2fa4617 commit a11082d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/app/api/goals/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export async function GET() {
177177
}
178178
}
179179

180-
const goalsWithHistory = processedGoals.map((goal) => ({
180+
const goalsWithHistory = (processedGoals ?? []).map((goal) => ({
181181
...goal,
182182
last_period: latestHistoryByGoal.get(goal.id) ?? null,
183183
}));

src/components/GoalTracker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ export default function GoalTracker() {
429429
const data: { goal: Goal } = await response.json();
430430

431431
setGoals((currentGoals) =>
432-
currentGoals.map((goal) => (goal.id === data.goal.id ? data.goal : goal))
432+
(currentGoals ?? []).map((goal) => (goal.id === data.goal.id ? data.goal : goal))
433433
);
434434
} catch {
435435
setShareError("Failed to update goal sharing. Please check your connection.");

0 commit comments

Comments
 (0)