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() {