From 507758ea3997e7b9867fc69914c87caf6297383a Mon Sep 17 00:00:00 2001 From: marshal Date: Wed, 17 Jun 2026 21:14:00 +0300 Subject: [PATCH] fix: update booking data structure to use meta.total and add null coalescing for checkbox states --- .../portal/src/pages/bookings/MyBookings.tsx | 4 ++-- .../pages/bookings/new-booking-form/step2-service-type.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/edr-freight-web/portal/src/pages/bookings/MyBookings.tsx b/apps/edr-freight-web/portal/src/pages/bookings/MyBookings.tsx index 2ce56cf1b..8d6323424 100644 --- a/apps/edr-freight-web/portal/src/pages/bookings/MyBookings.tsx +++ b/apps/edr-freight-web/portal/src/pages/bookings/MyBookings.tsx @@ -235,7 +235,7 @@ function useStatusCount(statuses: string | undefined): number | undefined { staleTime: 30_000, }), ); - return data?.total; + return data?.meta?.total; } function StatCard({ @@ -354,7 +354,7 @@ export default function MyBookings() { }; const allItems = data?.items ?? []; - const total = data?.total ?? allItems.length; + const total = data?.meta?.total ?? allItems.length; // Server handles status + pagination; reference search is applied on the page. const rows = useMemo(() => { diff --git a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step2-service-type.tsx b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step2-service-type.tsx index 20f63812f..e8edc5e5e 100644 --- a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step2-service-type.tsx +++ b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step2-service-type.tsx @@ -115,7 +115,7 @@ export function Step2ServiceType({ icon={} title="First Mile — Pick-up" description="Truck pick-up from your premises (Door to Port) to the origin rail yard." - checked={field.value} + checked={field.value ?? false} onChange={(value) => { field.onChange(value); if (!value) { @@ -157,7 +157,7 @@ export function Step2ServiceType({ icon={} title="Last Mile — Delivery" description="Truck delivery from the destination rail yard to the final address (Port to Door)." - checked={field.value} + checked={field.value ?? false} onChange={(value) => { field.onChange(value); if (!value) { @@ -225,7 +225,7 @@ export function Step2ServiceType({ icon={} title="Customs Clearing Service" description="EDR handles customs documentation and clearance on your behalf." - checked={field.value} + checked={field.value ?? false} onChange={(v) => field.onChange(v)} /> )}