diff --git a/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts b/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts index a635a92d..f8e7a93d 100644 --- a/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts +++ b/web/hwlab-cloud-web/src/composables/useWorkbenchNowTicker.ts @@ -4,7 +4,6 @@ import { onBeforeUnmount, readonly, ref, watch, type Ref } from "vue"; const TICK_INTERVAL_MS = 1000; -const MAX_VISIBLE_TICK_STEP_MS = TICK_INTERVAL_MS; const nowMs = ref(Date.now()); const activeSubscribers = new Map(); @@ -31,18 +30,8 @@ export function useWorkbenchNowTicker(enabled: Ref) { return { nowMs: readonly(nowMs), refreshNow }; } -function refreshNow(reset = false): void { - const wallNow = Date.now(); - if (reset) { - nowMs.value = wallNow; - return; - } - const previous = Number(nowMs.value); - if (!Number.isFinite(previous) || wallNow <= previous) { - nowMs.value = wallNow; - return; - } - nowMs.value = Math.min(wallNow, previous + MAX_VISIBLE_TICK_STEP_MS); +function refreshNow(): void { + nowMs.value = Date.now(); } function reconcileTimer(): void { @@ -51,7 +40,7 @@ function reconcileTimer(): void { // elapsed/recent labels advance monotonically instead of jumping on resume. const shouldRun = isBrowser() && hasActiveSubscriber(); if (shouldRun && timer === null) { - refreshNow(true); + refreshNow(); timer = window.setInterval(refreshNow, TICK_INTERVAL_MS); return; }