From bc031880bfbb4446d75474eaa1e5b91d91c52fef Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 26 Nov 2026 01:59:29 +1100 Subject: [PATCH] fix(ui/events): keep the open step alive across tab switches Each switch remounted the panel under ``'s key, so it started with no data and showed its skeleton before the read landed. KeepAlive keeps every visited step mounted, so returning shows what it already read. A step that is only polled (Events) pauses while hidden. --- ui/src/events/EventsPage.vue | 7 ++++++- ui/src/lib/use-read.ts | 10 +++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/src/events/EventsPage.vue b/ui/src/events/EventsPage.vue index 830c5dd3b..941e74d9b 100644 --- a/ui/src/events/EventsPage.vue +++ b/ui/src/events/EventsPage.vue @@ -117,7 +117,12 @@ const panel = computed(() => PANELS[active.value]); - + + + + Event automation is not enabled diff --git a/ui/src/lib/use-read.ts b/ui/src/lib/use-read.ts index 59a61e880..ecfbedba5 100644 --- a/ui/src/lib/use-read.ts +++ b/ui/src/lib/use-read.ts @@ -1,4 +1,4 @@ -import { onScopeDispose, ref, shallowRef, type Ref, type ShallowRef } from "vue"; +import { onActivated, onDeactivated, onScopeDispose, ref, shallowRef, type Ref, type ShallowRef } from "vue"; import { errors } from "@/copy/errors"; import { describeError } from "./api"; @@ -37,10 +37,14 @@ export function useRead(read: () => Promise): Read { } /** usePoll re-reads every intervalMs while the tab is visible, for views - * whose data the live stream does not carry. */ + * whose data the live stream does not carry. A view kept alive by KeepAlive + * pauses while it is hidden, so every visited tab is not polling at once. */ export function usePoll(reload: () => unknown, intervalMs = 5000): void { + let shown = true; + onActivated(() => (shown = true)); + onDeactivated(() => (shown = false)); const timer = setInterval(() => { - if (!document.hidden) void reload(); + if (shown && !document.hidden) void reload(); }, intervalMs); onScopeDispose(() => clearInterval(timer)); }