fix: dashboard cards no longer disappear on refresh — use prop trigger instead of key remount
This commit is contained in:
@@ -594,7 +594,8 @@ function countByStatus(items: { status: string }[]): TabCounts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function DashboardSummary({ onNavigate, onFilter }: {
|
function DashboardSummary({ refreshTrigger, onNavigate, onFilter }: {
|
||||||
|
refreshTrigger: number;
|
||||||
onNavigate: (tab: Tab) => void;
|
onNavigate: (tab: Tab) => void;
|
||||||
onFilter: (f: BookingFilter) => void;
|
onFilter: (f: BookingFilter) => void;
|
||||||
}) {
|
}) {
|
||||||
@@ -636,7 +637,8 @@ function DashboardSummary({ onNavigate, onFilter }: {
|
|||||||
remindersCancelled: upcoming.filter((r) => r.reminderStatus === "cancelled").length,
|
remindersCancelled: upcoming.filter((r) => r.reminderStatus === "cancelled").length,
|
||||||
});
|
});
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}, []);
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [refreshTrigger]);
|
||||||
|
|
||||||
if (!counts) return null;
|
if (!counts) return null;
|
||||||
|
|
||||||
@@ -898,7 +900,7 @@ function BookingsPageInner() {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{/* Dashboard — what needs attention */}
|
{/* Dashboard — what needs attention */}
|
||||||
<DashboardSummary key={`dash-${dashboardKey}-${refreshKey}`} onNavigate={setTab} onFilter={setStatusFilter} />
|
<DashboardSummary refreshTrigger={dashboardKey + refreshKey} onNavigate={setTab} onFilter={setStatusFilter} />
|
||||||
|
|
||||||
{/* Tabs */}
|
{/* Tabs */}
|
||||||
<div className="mt-5 flex border-b border-white/10">
|
<div className="mt-5 flex border-b border-white/10">
|
||||||
|
|||||||
Reference in New Issue
Block a user