fix(dashboard): pause job polling in a hidden tab

Skip the 2 s /api/status poll while document.hidden, and drop the leftover console.log of every status payload.
This commit is contained in:
pedro-bento 2026-10-05 21:17:09 +01:00
parent 92c68f9fcf
commit 3f57f4de51

View file

@ -474,9 +474,11 @@ function App() {
let interval; let interval;
if ((status === 'processing' || status === 'completed') && jobId) { if ((status === 'processing' || status === 'completed') && jobId) {
interval = setInterval(async () => { interval = setInterval(async () => {
// Skip a backgrounded tab: with the dashboard open in several tabs the
// hidden ones kept polling /api/status and flooding the access log.
if (document.hidden) return;
try { try {
const data = await pollJob(jobId); const data = await pollJob(jobId);
console.log("Job status:", data);
// Update results if available (real-time) // Update results if available (real-time)
if (data.result) { if (data.result) {