Fix draft pause clock: use Math.ceil consistently via shared msToSeconds helper #78

Merged
chrisp merged 1 commit from fix/draft-pause-clock-rounding into main 2026-06-06 23:49:15 +00:00
Owner

Summary

  • Pause snapshot (onDraftPaused) used Math.floor while the client countdown used Math.ceil, causing the visible clock to round down by 1 second the moment you clicked pause
  • draft-state-sync (sent to reconnecting clients) also used Math.floor, so reconnecting mid-countdown showed a different value than other clients
  • Extracted msToSeconds(ms) to app/lib/draft-timer.ts as the single source of truth — all four call sites across server and client now go through the same function, making a floor/ceil regression structurally impossible

Test plan

  • Start a draft, let the pick timer run to a mid-second value (e.g. 48.3s showing as "49"), click Pause — clock should stay at "49", not jump to "48"
  • Resume — clock should start counting down from "49"
  • Reconnect to the draft room mid-countdown and confirm the timer value matches other clients
  • Reconnect mid-pause and confirm the frozen timer value matches what was shown at pause time

🤖 Generated with Claude Code

## Summary - Pause snapshot (`onDraftPaused`) used `Math.floor` while the client countdown used `Math.ceil`, causing the visible clock to round down by 1 second the moment you clicked pause - `draft-state-sync` (sent to reconnecting clients) also used `Math.floor`, so reconnecting mid-countdown showed a different value than other clients - Extracted `msToSeconds(ms)` to `app/lib/draft-timer.ts` as the single source of truth — all four call sites across server and client now go through the same function, making a floor/ceil regression structurally impossible ## Test plan - [ ] Start a draft, let the pick timer run to a mid-second value (e.g. 48.3s showing as "49"), click Pause — clock should stay at "49", not jump to "48" - [ ] Resume — clock should start counting down from "49" - [ ] Reconnect to the draft room mid-countdown and confirm the timer value matches other clients - [ ] Reconnect mid-pause and confirm the frozen timer value matches what was shown at pause time 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chrisp added 1 commit 2026-06-06 23:40:16 +00:00
Fix draft pause clock: use Math.ceil consistently via shared msToSeconds helper
All checks were successful
🚀 Deploy / 🧪 Test (pull_request) Successful in 2m30s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Successful in 1m19s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
77c0f47552
- Pause snapshot used Math.floor while the client display used Math.ceil,
  causing the visible clock to round down by 1s on pause click
- draft-state-sync also used Math.floor for reconnecting clients
- Extract msToSeconds() to app/lib/draft-timer.ts as the single source of
  truth for all ms→seconds conversions across server and client

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
chrisp merged commit 6ba8adab5b into main 2026-06-06 23:49:15 +00:00
chrisp deleted branch fix/draft-pause-clock-rounding 2026-06-06 23:49:16 +00:00
Sign in to join this conversation.
No description provided.