fix loading flicker on /bookings
(#1062)
This commit is contained in:
parent
f91de82daf
commit
5af159cf4e
1 changed files with 5 additions and 3 deletions
|
@ -40,6 +40,8 @@ export default function Bookings() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isEmpty = !query.data?.pages[0]?.bookings.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Shell heading={t("bookings")} subtitle={t("bookings_description")}>
|
<Shell heading={t("bookings")} subtitle={t("bookings_description")}>
|
||||||
<BookingsShell>
|
<BookingsShell>
|
||||||
|
@ -49,8 +51,8 @@ export default function Bookings() {
|
||||||
{query.status === "error" && (
|
{query.status === "error" && (
|
||||||
<Alert severity="error" title={t("something_went_wrong")} message={query.error.message} />
|
<Alert severity="error" title={t("something_went_wrong")} message={query.error.message} />
|
||||||
)}
|
)}
|
||||||
{query.status === "loading" || (query.status === "idle" && <Loader />)}
|
{(query.status === "loading" || query.status === "idle") && <Loader />}
|
||||||
{query.status === "success" && query.data.pages[0].bookings.length > 0 && (
|
{query.status === "success" && !isEmpty && (
|
||||||
<>
|
<>
|
||||||
<div className="mt-6 overflow-hidden border border-b border-gray-200 rounded-sm">
|
<div className="mt-6 overflow-hidden border border-b border-gray-200 rounded-sm">
|
||||||
<table className="min-w-full divide-y divide-gray-200">
|
<table className="min-w-full divide-y divide-gray-200">
|
||||||
|
@ -75,7 +77,7 @@ export default function Bookings() {
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{query.status === "success" && query.data.pages[0].bookings.length === 0 && (
|
{query.status === "success" && isEmpty && (
|
||||||
<EmptyScreen
|
<EmptyScreen
|
||||||
Icon={CalendarIcon}
|
Icon={CalendarIcon}
|
||||||
headline={t("no_status_bookings_yet", { status: status })}
|
headline={t("no_status_bookings_yet", { status: status })}
|
||||||
|
|
Loading…
Reference in a new issue