From 5a166ee430171ae69acb69e15410d09d3a5c135d Mon Sep 17 00:00:00 2001 From: Eunjae Lee Date: Thu, 13 Feb 2025 11:40:17 +0100 Subject: [PATCH] fix: remove section on /bookings if no data exists (#19261) --- .../bookings/views/bookings-listing-view.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/web/modules/bookings/views/bookings-listing-view.tsx b/apps/web/modules/bookings/views/bookings-listing-view.tsx index 7d1cb8102e..17ae45d8bb 100644 --- a/apps/web/modules/bookings/views/bookings-listing-view.tsx +++ b/apps/web/modules/bookings/views/bookings-listing-view.tsx @@ -219,17 +219,17 @@ function BookingsContent({ status }: BookingsProps) { }, [query.data]); const finalData = useMemo(() => { - if (bookingsToday.length > 0 && status === "upcoming") { - const merged: RowData[] = [ - { type: "today" as const }, - ...bookingsToday, - { type: "next" as const }, - ...flatData, - ]; - return merged; - } else { + if (status !== "upcoming") { return flatData; } + const merged: RowData[] = []; + if (bookingsToday.length > 0) { + merged.push({ type: "today" as const }, ...bookingsToday); + } + if (flatData.length > 0) { + merged.push({ type: "next" as const }, ...flatData); + } + return merged; }, [bookingsToday, flatData, status]); const table = useReactTable({