diff --git a/pages/bookings/[status].tsx b/pages/bookings/[status].tsx index bc7fd93096..fd237910b5 100644 --- a/pages/bookings/[status].tsx +++ b/pages/bookings/[status].tsx @@ -40,6 +40,8 @@ export default function Bookings() { } }); + const isEmpty = !query.data?.pages[0]?.bookings.length; + return ( @@ -49,8 +51,8 @@ export default function Bookings() { {query.status === "error" && ( )} - {query.status === "loading" || (query.status === "idle" && )} - {query.status === "success" && query.data.pages[0].bookings.length > 0 && ( + {(query.status === "loading" || query.status === "idle") && } + {query.status === "success" && !isEmpty && ( <>
@@ -75,7 +77,7 @@ export default function Bookings() { )} - {query.status === "success" && query.data.pages[0].bookings.length === 0 && ( + {query.status === "success" && isEmpty && (