From 8c064f30ff8d00c157d7011886936f77dc313690 Mon Sep 17 00:00:00 2001 From: RandithaK Date: Wed, 12 Nov 2025 15:35:59 +0530 Subject: [PATCH] fix: Handle potential null values for mileage and totalAmount in vehicle components --- src/app/components/VehicleCard.tsx | 2 +- src/app/components/dashboards/CustomerDashboard.tsx | 2 +- src/app/dashboard/vehicles/[vehicleId]/page.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/components/VehicleCard.tsx b/src/app/components/VehicleCard.tsx index c2a70f4..fcdac0f 100644 --- a/src/app/components/VehicleCard.tsx +++ b/src/app/components/VehicleCard.tsx @@ -28,7 +28,7 @@ export default function VehicleCard({ vehicle, onDelete, onEdit }: VehicleCardPr
Mileage: - {vehicle.mileage.toLocaleString()} miles + {(vehicle.mileage ?? 0).toLocaleString()} miles
diff --git a/src/app/components/dashboards/CustomerDashboard.tsx b/src/app/components/dashboards/CustomerDashboard.tsx index fab65b5..1867e12 100644 --- a/src/app/components/dashboards/CustomerDashboard.tsx +++ b/src/app/components/dashboards/CustomerDashboard.tsx @@ -155,7 +155,7 @@ const CustomerDashboard: React.FC = ({ profile }) => { overdueInvoices.slice(0, 3).map((invoice) => (

Invoice {invoice.invoiceNumber}

-

Amount due: LKR {invoice.totalAmount.toLocaleString()}

+

Amount due: LKR {(invoice.totalAmount ?? 0).toLocaleString()}

Mileage

-
{vehicle.mileage.toLocaleString()} mi
+
{(vehicle.mileage ?? 0).toLocaleString()} mi

Color