From 392a76fef7196c031d7bd80d11cdbc9be5865806 Mon Sep 17 00:00:00 2001 From: Dave Date: Mon, 31 Aug 2026 22:38:41 +0200 Subject: [PATCH] fix(boss-dashboard): show raw claim count + fix stale window on tab switch "Claimed" was gated to emailed/approved/sent quotes, undercounting reps who claim a lot but haven't pushed everything out yet (e.g. Karin showed 1 instead of her actual 4 claimed today). Swap in quotesLoaded so it reflects total quotes processed, any status. Also fixes tab switching (Today/Week/Month) needing a manual refresh to show the right numbers: selectWindow() called fetchData() before the activeWindowRef mirroring effect had run, so the fetch used the previous tab's window. Now set synchronously in the click handler. Co-Authored-By: Claude Sonnet 5 --- src/app/(mobile)/m/dashboard-view.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/(mobile)/m/dashboard-view.tsx b/src/app/(mobile)/m/dashboard-view.tsx index 5dc6fbb..a29940b 100644 --- a/src/app/(mobile)/m/dashboard-view.tsx +++ b/src/app/(mobile)/m/dashboard-view.tsx @@ -111,6 +111,11 @@ export default function BossDashboardView() { // calls setState on every render. const selectWindow = useCallback((w: BossWindow) => { if (w === activeWindowRef.current) return; + // Set the ref synchronously — the mirroring effect (line ~42) only + // fires after React re-renders, which is too late for the fetchData + // call below. Without this, fetchData reads the stale window and the + // tab shows the previous window's numbers until a manual refresh. + activeWindowRef.current = w; setActiveWindow(w); setSheetRep(null); setSheetItems([]); @@ -317,7 +322,7 @@ export default function BossDashboardView() {
{rep.name}
- +
@@ -431,7 +436,7 @@ export default function BossDashboardView() {
{sheetRep.name}
- {sheetRep.quotesDoneFor} loaded · {sheetRep.quotesDoneBy} claimed + {sheetRep.quotesDoneFor} loaded · {sheetRep.quotesLoaded} claimed · {sheetRep.ordersPlaced} orders