diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx index 9616d14..dc0a901 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/Home/Home.tsx @@ -194,6 +194,8 @@ function Home() { }; }, [todayTransactions, weekTransactions, categories, monthlyBudgetSpentTotal]); + const weeklyTotal = useMemo(() => calculateTotalExpense(weekTransactions), [weekTransactions]); + const recentTransactionsForAI = useMemo(() => { return weekTransactions.map(t => ({ date: new Date(t.transactionDate).toLocaleDateString('zh-CN'), @@ -320,7 +322,7 @@ function Home() { top3Categories={top3Categories} todayTransactionCount={todayTransactionCount} last7DaysSpend={last7DaysSpend} - weeklyTotal={useMemo(() => calculateTotalExpense(weekTransactions), [weekTransactions])} + weeklyTotal={weeklyTotal} />