## Summary - The countdown display used `data.expiresAt` (server-side Unix timestamp) subtracted from `client Date.now()`. When the server clock runs ~2-3s ahead of the client (observed in production), the display was inflated by that delta. - Fixes three linked symptoms: timer starting at 2:02 instead of 2:00, chess-clock increment crediting 1:54 instead of 1:55, and the commissioner's adjust-time-bank dialog disagreeing with the visible countdown. - Fix: replace all server `expiresAt` timestamps with a client-local expiry from the server-provided `timeRemaining` integer (`Date.now() + timeRemaining * 1000`). The skew then cancels algebraically when the server computes credit. ## Sites changed - `handleTimerPickStarted` — fires after every pick (the main fix) - `handleDraftStateSync` — reconnect path - `useState` initializer in the draft room — initial page load seed from loader data (uses `loaderTimerNow` server timestamp to compute remaining server-side, then re-anchors to client clock) ## Test plan - [ ] Start a chess-clock draft (2:00 bank, 15s increment) — timer should show exactly **2:00** when a team goes on the clock - [ ] Pick at 1:40 — new bank should show **1:55** (100 + 15s) - [ ] Commissioner adjust-time-bank dialog — displayed remaining should match the countdown - [ ] Force autopick at any displayed time T — new bank should be T + increment - [ ] Reconnect mid-pick — timer should resume at the correct remaining time 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Chris Parsons <chrisparsons1127@gmail.com> Reviewed-on: #74 |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| useDraftAuthRecovery.ts | ||
| useDraftNotifications.ts | ||
| useDraftRoomState.ts | ||
| useDraftSocket.ts | ||
| useDraftSocketEvents.ts | ||
| useFocusTrap.ts | ||
| useLocalTimezone.ts | ||
| useMediaQuery.ts | ||
| useRoundTransition.ts | ||
| useSortableData.ts | ||