From e70446a46e2e618a3d0d3a610fc51f39c67917b8 Mon Sep 17 00:00:00 2001 From: derekc Date: Tue, 3 Mar 2026 00:26:39 -0800 Subject: [PATCH] Fix TV timer not starting after reset (or fresh block start) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit applySnapshot checked serverElapsed > 0 before setting blockStartedAt, so any block with 0 elapsed (just reset, or started within the same second) was loaded with blockStartedAt = null — the timer appeared frozen. The condition now only checks for a current_block_id; the isPaused flag already handles the "selected but not started" case correctly. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/stores/schedule.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/stores/schedule.js b/frontend/src/stores/schedule.js index b3a75fa..311391b 100644 --- a/frontend/src/stores/schedule.js +++ b/frontend/src/stores/schedule.js @@ -44,10 +44,11 @@ export const useScheduleStore = defineStore('schedule', () => { morningRoutine.value = snapshot.morning_routine || [] // Restore elapsed time from server-computed value and seed the per-block cache const serverElapsed = snapshot.block_elapsed_seconds || 0 - if (snapshot.session?.current_block_id && serverElapsed > 0) { + if (snapshot.session?.current_block_id) { blockElapsedCache.value[snapshot.session.current_block_id] = serverElapsed blockElapsedOffset.value = serverElapsed - // Only start the live counter if the block is actually running (not paused) + // Start the live counter only when the block is actually running (not paused). + // Use serverElapsed == 0 is fine here — a just-reset block is still running. blockStartedAt.value = isPaused.value ? null : Date.now() } else { blockElapsedOffset.value = 0