feat(dashboard): poll optimisation — T4, T5, T6

T4: workstreams.md and dependencies.md now call /state/deps instead of the
    full /state/summary — removes 2 heavy 10-table queries per 60 s cycle.

T5: index.md's 4 independent polling loops (summaryState, sbomSnapState,
    regsState, wsChartState) consolidated into a single pageState generator
    with one Promise.all batch and a shared backoff counter.

T6: config.js gains waitForVisible(ms) — pauses polling entirely while the
    tab is hidden and fires immediately on visibilitychange.  pollDelay()
    simplified (hidden-tab POLL_HIDDEN logic removed).  All 16 polling pages
    migrated from await sleep(pollDelay(...)) to await waitForVisible(pollDelay(...)).

CUST-WP-0039 complete — all 6 tasks done.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 17:58:18 +02:00
parent b832032cc3
commit 90c5ea50f7
18 changed files with 111 additions and 155 deletions

View File

@@ -3,7 +3,7 @@ title: Capability Requests
---
```js
import {API, apiFetch, pollDelay, sleep} from "./components/config.js";
import {API, apiFetch, pollDelay, waitForVisible} from "./components/config.js";
const POLL = 30_000;
```
@@ -20,7 +20,7 @@ const reqState = (async function*() {
} catch {}
failures = ok ? 0 : failures + 1;
yield {data, ok, ts: new Date()};
await sleep(pollDelay({ok, base: POLL, failures}));
await waitForVisible(pollDelay({ok, base: POLL, failures}));
}
})();
```
@@ -210,7 +210,7 @@ const catalogState = (async function*() {
} catch {}
failures = ok ? 0 : failures + 1;
yield data;
await sleep(pollDelay({ok, base: POLL, failures}));
await waitForVisible(pollDelay({ok, base: POLL, failures}));
}
})();
```