From 084f7a45d3351162f268425c4a05c37f98146795 Mon Sep 17 00:00:00 2001 From: CartSnitch Engineer Bot Date: Wed, 1 Apr 2026 19:37:44 +0000 Subject: [PATCH 1/2] fix(frontend): remove hardcoded mock product IDs from Dashboard price trends Removed usePriceHistory calls with hardcoded string product IDs (prod1, prod10) that caused 422 errors against the UUID-expecting API. The Price Trends section now shows a placeholder until a proper featured-products endpoint is available. Co-Authored-By: Paperclip --- src/pages/Dashboard.tsx | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index d7c2b9a..9e65c95 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -1,13 +1,9 @@ -import React, { Suspense } from 'react' +import React from 'react' import { Link } from 'react-router-dom' import { authClient } from '../lib/auth-client.ts' -import { usePurchases, usePriceAlerts, usePriceHistory } from '../hooks/useApi.ts' +import { usePurchases, usePriceAlerts } from '../hooks/useApi.ts' import { StoreIcon } from '../components/StoreIcon.tsx' -const LazySparklineCard = React.lazy(() => - import('../components/SparklineChart.tsx').then((mod) => ({ default: mod.SparklineCard })) -) - export function Dashboard() { const { data: session, isPending } = authClient.useSession() @@ -44,19 +40,11 @@ export function Dashboard() { function AuthenticatedDashboard({ userName }: { userName: string }) { const { data: purchases = [], isLoading: purchasesLoading } = usePurchases() const { data: alerts = [], isLoading: alertsLoading } = usePriceAlerts() - const { data: eggHistory = [] } = usePriceHistory('prod10') - const { data: milkHistory = [] } = usePriceHistory('prod1') const triggeredAlerts = alerts.filter((a) => a.triggered) const watchingAlerts = alerts.filter((a) => !a.triggered) const recentPurchases = purchases.slice(0, 3) - const sparklineData = eggHistory.filter((p) => p.storeId === 'meijer').slice(-8) - const milkSparkline = milkHistory.filter((p) => p.storeId === 'kroger').slice(-8) - - const eggCurrent = sparklineData.length > 0 ? `$${sparklineData[sparklineData.length - 1].price.toFixed(2)}` : '—' - const milkCurrent = milkSparkline.length > 0 ? `$${milkSparkline[milkSparkline.length - 1].price.toFixed(2)}` : '—' - if (purchasesLoading || alertsLoading) { return } @@ -106,11 +94,8 @@ function AuthenticatedDashboard({ userName }: { userName: string }) { {/* Price trend sparklines */}

Price Trends

-
- }> - - - +
+ Connect a store to see price trends
@@ -187,15 +172,3 @@ function DashboardSkeleton() { ) } - -function SparklinePlaceholder() { - return ( -
-
-
-
-
-
-
- ) -} From c647ba19daa1d45ee843da9eafcfe770e1f59b84 Mon Sep 17 00:00:00 2001 From: CartSnitch Engineer Bot Date: Wed, 1 Apr 2026 19:58:41 +0000 Subject: [PATCH 2/2] fix(frontend): remove unused React import from Dashboard.tsx Co-Authored-By: Paperclip --- src/pages/Dashboard.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx index 9e65c95..c3f428a 100644 --- a/src/pages/Dashboard.tsx +++ b/src/pages/Dashboard.tsx @@ -1,4 +1,3 @@ -import React from 'react' import { Link } from 'react-router-dom' import { authClient } from '../lib/auth-client.ts' import { usePurchases, usePriceAlerts } from '../hooks/useApi.ts'