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

This commit is contained in:
Eunjae Lee
2025-02-13 11:40:17 +01:00
committed by GitHub
parent f6f964d495
commit 5a166ee430
@@ -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>({