Problem
When a new batch starts, the dashboard briefly shows the previous batch's history view before switching to the new batch. This happens because the #487 fix (clear viewer when batch disappears) triggers during a brief polling gap where batch-state.json is being written.
Sequence
- New batch starts → batch-state.json being created
- Dashboard poll reads no batch (file not yet written or in-flight)
lastBatchId logic detects "batch gone" → clears viewer → shows history
- Next poll picks up new batch → switches back to live view
Fix
Add a brief debounce: only flip to history if "no batch" persists for 2+ consecutive polls (10+ seconds). A single missing poll should not trigger the transition.
Related
Problem
When a new batch starts, the dashboard briefly shows the previous batch's history view before switching to the new batch. This happens because the #487 fix (clear viewer when batch disappears) triggers during a brief polling gap where batch-state.json is being written.
Sequence
lastBatchIdlogic detects "batch gone" → clears viewer → shows historyFix
Add a brief debounce: only flip to history if "no batch" persists for 2+ consecutive polls (10+ seconds). A single missing poll should not trigger the transition.
Related