File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 } ) ) ;
Original file line number Diff line number Diff 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." ) ;
You can’t perform that action at this time.
0 commit comments