Skip to content

Scheduling infrastructure for absolutely everyone.

fix: remove section on /bookings if no data exists (#19261)

Eunjae Lee5a166ee43017
diff --git a/apps/web/modules/bookings/views/bookings-listing-view.tsx b/apps/web/modules/bookings/views/bookings-listing-view.tsx
index 7d1cb8102e3..17ae45d8bb1 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<RowData[]>(() => {
- 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<RowData>({