Merge pull request 'fix(web): classic timer ran at 2x (idempotent startTimer)' (#96) from fix/classic-timer-double-count into master
Build and Deploy / build-and-push (push) Successful in 6m8s
Web E2E / web-e2e (push) Successful in 7m5s

This commit was merged in pull request #96.
This commit is contained in:
2026-06-24 00:18:53 +00:00
+5
View File
@@ -270,6 +270,11 @@ function startGame(seed) {
// ── Timer ────────────────────────────────────────────────────────────────────
function startTimer() {
// Idempotent: never stack a second interval. The visibilitychange handler
// and startGame can both call this, and a stray call (e.g. a load-time
// visibilitychange while a timer is already running) would otherwise leak
// the old interval and make elapsedSecs increment twice per second.
if (timerInterval) return;
timerInterval = setInterval(() => {
elapsedSecs++;
updateTimerDisplay();