From 839b85d17c88797bc47edde9840cb15dc7538cb6 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Tue, 23 Jun 2026 20:38:39 +0800 Subject: [PATCH] fix(workbench): keep timing ticker active in background pages (#1985) Co-authored-by: root --- .../src/composables/useWorkbenchNowTicker.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts b/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts index ccdc59c2..f8e7a93d 100644 --- a/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts +++ b/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts @@ -35,7 +35,10 @@ function refreshNow(): void { } function reconcileTimer(): void { - const shouldRun = isBrowser() && isDocumentVisible() && hasActiveSubscriber(); + // Passive observer pages may be backgrounded while still being the source of + // web-probe samples. Keep the render ticker alive for active subscribers so + // elapsed/recent labels advance monotonically instead of jumping on resume. + const shouldRun = isBrowser() && hasActiveSubscriber(); if (shouldRun && timer === null) { refreshNow(); timer = window.setInterval(refreshNow, TICK_INTERVAL_MS); @@ -74,7 +77,3 @@ function handleVisibilityChange(): void { function isBrowser(): boolean { return typeof window !== "undefined"; } - -function isDocumentVisible(): boolean { - return typeof document === "undefined" || document.visibilityState !== "hidden"; -}