From 9ad7f91c046eb2243f5bb748ec38f6bea9429a7c Mon Sep 17 00:00:00 2001 From: Deng Liu Date: Thu, 3 Dec 2026 17:46:43 -0800 Subject: [PATCH] fix(automations): allow scrolling overflowing schedule and run lists (#7901) The list frame's overflow: hidden let it shrink to the editor height, so rows past the fold were clipped instead of scrolled. The header and tabs now stay pinned above a dedicated scroll body, the footer stays pinned below it, the scroll position resets on tab switch, and a deep-linked schedule row scrolls into view. Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com> --- e2e/agentAutomations.spec.ts | 138 ++++++ src/features/agents/Automations.module.css | 107 ++++- src/features/agents/AutomationsEditor.tsx | 533 +++++++++++---------- src/features/agents/automations.test.tsx | 50 +- src/features/agents/automationsModel.ts | 3 + 5 files changed, 555 insertions(+), 276 deletions(-) diff --git a/e2e/agentAutomations.spec.ts b/e2e/agentAutomations.spec.ts index 594959394c..b6e257da83 100644 --- a/e2e/agentAutomations.spec.ts +++ b/e2e/agentAutomations.spec.ts @@ -1760,3 +1760,141 @@ test("configures effort level and context window in Edit Automation dialog and p await row.getByRole("button", { name: "Edit Automation" }).click(); await expect(dialog.getByRole("button", { name: /^Model settings:/ })).toContainText("Extra High · 1M"); }); + +test("scrolls overflowing Schedules and Run History lists without clipping while keeping header, tabs, and footer pinned", async ({ + workbench: page, +}) => { + await page.setViewportSize({ width: 1120, height: 680 }); + await installAutomationDesktopHarness(page); + + const ids = await page.evaluate(async () => { + const autoMod = "/src/features/agents/automationsModel.ts"; + const { openAutomations, refreshAutomations } = await import(/* @vite-ignore */ autoMod); + const createdIds: string[] = []; + const now = Date.now(); + + for (let i = 1; i <= 10; i++) { + const saved = (await window.__ipc.handlers.agent_automation_save!({ + input: { + name: `Daily Workflow ${i} (Self-Scheduling)`, + enabled: true, + prompt: { + text: `Run recurring workflow #${i} and inspect CI, repository status, and pending follow-ups.`, + files: [], + images: [], + }, + workspace: { kind: "project", root: "/dev/acme-api", isolation: "local", autoCleanWorktree: false }, + continuity: "sameTask", + provider: "claude", + config: [], + permissions: "allowAll", + trigger: { kind: "daily", hour: (8 + i) % 24, minute: 0, timeZone: "UTC" }, + allowAgentSchedule: i % 2 === 1, + }, + })) as AgentAutomation_Serialize; + createdIds.push(saved.id); + if (i <= 3) { + window.__ipc.handlers.__test_set_override!({ + id: saved.id, + nextRunOverrideMs: now + i * 1_800_000, + nextPromptOverride: `Follow up on workflow #${i} after cooldown completes.`, + }); + } + } + + // Trigger runs across automations so Run History also overflows the viewport. + for (let i = 0; i < 10; i++) { + await window.__ipc.handlers.agent_automation_run_now!({ id: createdIds[i % createdIds.length]! }); + await window.__ipc.handlers.agent_automation_run_now!({ id: createdIds[i % createdIds.length]! }); + } + + await refreshAutomations(); + await openAutomations({ tab: "schedules" }); + return createdIds; + }); + + const editor = page.getByTestId("automations-editor"); + const scrollBody = page.getByTestId("automations-scroll-body"); + await expect(editor).toBeVisible(); + await expect(editor.locator('[data-testid^="automation-row-"]')).toHaveCount(10); + + // 1. Scroll container must overflow vertically, and the framed list must NOT clip its rows. + const schedulesMetrics = await scrollBody.evaluate((el) => { + const firstRow = el.querySelector('[data-testid^="automation-row-"]'); + const listFrame = firstRow?.parentElement; + return { + clientHeight: el.clientHeight, + scrollHeight: el.scrollHeight, + listClientHeight: listFrame?.clientHeight ?? 0, + listScrollHeight: listFrame?.scrollHeight ?? 0, + }; + }); + expect(schedulesMetrics.scrollHeight).toBeGreaterThan(schedulesMetrics.clientHeight + 100); + expect(schedulesMetrics.listScrollHeight).toBeLessThanOrEqual(schedulesMetrics.listClientHeight + 1); + + // 2. Scroll to the bottom -> last row is fully reachable & clickable while header, tabs, and footer stay pinned. + const rows = editor.locator('[data-testid^="automation-row-"]'); + const lastRow = rows.last(); + const lastRowId = (await lastRow.getAttribute("data-testid"))!.replace("automation-row-", ""); + await scrollBody.evaluate((el) => { + el.scrollTop = el.scrollHeight; + }); + + const afterScroll = await scrollBody.evaluate((el) => ({ + scrollTop: el.scrollTop, + rect: el.getBoundingClientRect(), + })); + expect(afterScroll.scrollTop).toBeGreaterThan(100); + + const lastRowBox = await lastRow.boundingBox(); + expect(lastRowBox).not.toBeNull(); + expect(lastRowBox!.y).toBeGreaterThanOrEqual(afterScroll.rect.y - 1); + expect(lastRowBox!.y + lastRowBox!.height).toBeLessThanOrEqual(afterScroll.rect.y + afterScroll.rect.height + 1); + + // Pinned chrome remains visible inside the editor while scrolled to the bottom. + const editorBox = (await editor.boundingBox())!; + const newBtnBox = (await editor.getByRole("button", { name: "New Automation" }).boundingBox())!; + const footerBox = (await editor.getByRole("checkbox", { name: /Keep automations running/ }).boundingBox())!; + expect(newBtnBox.y).toBeGreaterThanOrEqual(editorBox.y); + expect(newBtnBox.y + newBtnBox.height).toBeLessThanOrEqual(afterScroll.rect.y + 1); + expect(footerBox.y).toBeGreaterThanOrEqual(afterScroll.rect.y + afterScroll.rect.height - 1); + expect(footerBox.y + footerBox.height).toBeLessThanOrEqual(editorBox.y + editorBox.height + 1); + + // Bottom row action button is genuinely interactive. + await lastRow.getByRole("button", { name: "Edit Automation" }).click(); + await expect(page.getByRole("dialog", { name: "Edit Automation" })).toBeVisible(); + await page.keyboard.press("Escape"); + await expect(page.getByRole("dialog", { name: "Edit Automation" })).toHaveCount(0); + + // 3. Switch to Run History -> scroll resets to top and Run History also scrolls cleanly to its last run. + await editor.getByRole("tab", { name: /Run History/ }).click(); + await expect(editor.locator('[data-testid^="automation-run-"]')).toHaveCount(20); + await expect.poll(() => scrollBody.evaluate((el) => el.scrollTop)).toBe(0); + + const runsMetrics = await scrollBody.evaluate((el) => ({ + clientHeight: el.clientHeight, + scrollHeight: el.scrollHeight, + })); + expect(runsMetrics.scrollHeight).toBeGreaterThan(runsMetrics.clientHeight + 100); + + await scrollBody.evaluate((el) => { + el.scrollTop = el.scrollHeight; + }); + const lastRunBox = (await editor.locator('[data-testid^="automation-run-"]').last().boundingBox())!; + const runsRect = await scrollBody.evaluate((el) => el.getBoundingClientRect()); + expect(lastRunBox.y + lastRunBox.height).toBeLessThanOrEqual(runsRect.y + runsRect.height + 1); + + // 4. Deep-linking back to the bottom-most schedule scrolls that focused row into view automatically. + expect(ids).toContain(lastRowId); + await page.evaluate(async (targetId) => { + const autoMod = "/src/features/agents/automationsModel.ts"; + const { openAutomations } = await import(/* @vite-ignore */ autoMod); + openAutomations({ tab: "schedules", automationId: targetId }); + }, lastRowId); + + await expect.poll(() => scrollBody.evaluate((el) => el.scrollTop)).toBeGreaterThan(100); + const focusedBox = (await editor.getByTestId(`automation-row-${lastRowId}`).boundingBox())!; + const schedulesRect = await scrollBody.evaluate((el) => el.getBoundingClientRect()); + expect(focusedBox.y).toBeGreaterThanOrEqual(schedulesRect.y - 1); + expect(focusedBox.y + focusedBox.height).toBeLessThanOrEqual(schedulesRect.y + schedulesRect.height + 1); +}); diff --git a/src/features/agents/Automations.module.css b/src/features/agents/Automations.module.css index 9e14914f00..b763dd9c41 100644 --- a/src/features/agents/Automations.module.css +++ b/src/features/agents/Automations.module.css @@ -5,22 +5,30 @@ flex-direction: column; height: 100%; min-height: 0; - overflow-y: auto; + overflow: hidden; + container-type: inline-size; background: var(--bg-editor); color: var(--fg); font-size: var(--fs-ui); } .column { - display: flex; - flex-direction: column; - flex: 1; width: 100%; max-width: 820px; margin: 0 auto; - padding: 20px 28px 24px; + padding: 0 28px; box-sizing: border-box; - min-height: 0; +} + +.topChrome { + flex: none; + border-bottom: 1px solid var(--border); +} + +.topChrome .column { + display: flex; + flex-direction: column; + padding-top: 20px; } .header { @@ -92,7 +100,6 @@ flex-wrap: wrap; gap: var(--space-2); padding-bottom: 8px; - border-bottom: 1px solid var(--border); } .navControls { @@ -127,7 +134,6 @@ align-items: center; justify-content: space-between; gap: var(--space-2); - margin-bottom: 12px; padding: 8px 12px; border-radius: var(--radius-control); background: var(--bg-elev); @@ -143,35 +149,41 @@ min-width: 0; } -.body { +.scrollBody { flex: 1; + min-height: 0; + overflow-y: auto; + overflow-x: hidden; +} + +.body { display: flex; flex-direction: column; gap: var(--space-3); - padding: 16px 0 20px; - min-height: 0; + padding-top: 16px; + padding-bottom: 24px; } /* Framed list with hairline dividers, matching Settings > Agents > Skills. */ .listFrame { display: flex; flex-direction: column; + flex-shrink: 0; + border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--bg-editor); - box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; } .row { display: flex; align-items: flex-start; - justify-content: space-between; - gap: var(--space-3); + gap: var(--space-2); padding: 10px 12px; } .row + .row { - box-shadow: inset 0 1px 0 var(--border); + border-top: 1px solid var(--border); } .row:hover { @@ -183,12 +195,16 @@ box-shadow: inset 2px 0 0 var(--accent); } -.rowLeft { - display: flex; - align-items: flex-start; +.rowCenter { + justify-content: center; +} + +.rowLeading { + display: inline-flex; + align-items: center; gap: var(--space-2); - flex: 1; - min-width: 0; + flex-shrink: 0; + height: 24px; } .rowContent { @@ -199,12 +215,22 @@ flex: 1; } +.rowTop { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: var(--space-2); + min-width: 0; +} + .rowTitleLine { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1-5); + flex: 1; min-width: 0; + min-height: 24px; } .rowTitle { @@ -325,7 +351,7 @@ } .templateRow + .templateRow { - box-shadow: inset 0 1px 0 var(--border); + border-top: 1px solid var(--border); } .templateRow:hover { @@ -355,17 +381,52 @@ color: var(--fg-muted); } +.footer { + flex: none; + border-top: 1px solid var(--border); +} + .footerBar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); - padding-top: 12px; - border-top: 1px solid var(--border); + padding-top: 10px; + padding-bottom: 10px; color: var(--fg-secondary); font-size: var(--fs-small); } +@container (max-width: 560px) { + .column { + padding-inline: var(--space-4); + } + + .topChrome .column { + padding-top: var(--space-3); + } +} + +@container (max-width: 440px) { + .header { + flex-wrap: wrap; + } + + .navControls { + width: 100%; + margin-left: 0; + } + + .searchWrap { + flex: 1 1 160px; + width: auto; + } + + .rowTop { + flex-wrap: wrap; + } +} + /* Dialog form (aligned to Dialog's 16px titlebar / footer insets). */ .dialogForm { display: flex; diff --git a/src/features/agents/AutomationsEditor.tsx b/src/features/agents/AutomationsEditor.tsx index b0b4b9290c..93ef80a13f 100644 --- a/src/features/agents/AutomationsEditor.tsx +++ b/src/features/agents/AutomationsEditor.tsx @@ -4,7 +4,7 @@ * open any background run directly in `SessionEditor`. */ import clsx from "clsx"; -import { useMemo, useState } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import type { AgentAutomation_Serialize, AutomationRun_Serialize } from "@/bindings"; import { executeAction } from "@/platform/actions"; import { useTx } from "@/platform/i18n"; @@ -81,6 +81,10 @@ export function AutomationsEditor({ const loadError = useAutomations((s) => s.error); const activeTab = useAutomations((s) => s.activeTab); const focusAutomationId = useAutomations((s) => s.focusAutomationId); + const focusSeq = useAutomations((s) => s.focusSeq); + const scrollBodyRef = useRef(null); + const rowRefs = useRef>(new Map()); + const lastScrolledFocusRef = useRef(null); const untrustedProject = Boolean(project && !project.trusted); const [autoStartOverride, setAutoStartOverride] = useState(null); const autoStartEnabled = Boolean(autoStartOverride ?? agentSettings.automations.autoStartService); @@ -122,6 +126,20 @@ export function AutomationsEditor({ }); }, [snapshot.runs, query, runFilter]); + useEffect(() => { + if (scrollBodyRef.current) scrollBodyRef.current.scrollTop = 0; + }, [activeTab]); + + useEffect(() => { + if (activeTab !== "schedules" || !focusAutomationId) return; + const token = `${focusSeq}:${focusAutomationId}`; + if (lastScrolledFocusRef.current === token) return; + const el = rowRefs.current.get(focusAutomationId); + if (!el) return; + lastScrolledFocusRef.current = token; + el.scrollIntoView?.({ block: "nearest" }); + }, [activeTab, focusAutomationId, focusSeq, filteredAutomations]); + const handleToggleEnabled = async (auto: AgentAutomation_Serialize) => { setBusyId(auto.id); try { @@ -376,140 +394,144 @@ export function AutomationsEditor({ return (
-
-
-
-

- Agent Automations -

- - 0 && styles.statusDotOn)} - aria-hidden="true" - /> - {host.remote && } - {host.remote ? tx("Remote Daemon") : tx("Local Host")} - · - - {host.activeSchedules === 1 ? tx("1 active schedule") : tx`${host.activeSchedules} active schedules`} +
+
+
+
+

+ Agent Automations +

+ + 0 && styles.statusDotOn)} + aria-hidden="true" + /> + {host.remote && } + {host.remote ? tx("Remote Daemon") : tx("Local Host")} + · + + {host.activeSchedules === 1 ? tx("1 active schedule") : tx`${host.activeSchedules} active schedules`} + + {host.bootServiceRegistered && ( + <> + · + + Auto-starts on login + + + )} - {host.bootServiceRegistered && ( +
+ +
+ + void executeAction("file.settings", AUTOMATIONS_PAGE)} + /> + showContextMenu(e, headerMoreMenu())} /> +
+
+ +
+ setAutomationsTab(id as "schedules" | "runs")} + items={[ + { + id: "schedules", + label: Schedules, + text: "Schedules", + trailing: snapshot.automations.length ? ( + {snapshot.automations.length} + ) : undefined, + }, + { + id: "runs", + label: Run History, + text: "Run History", + trailing: + host.unreadRuns > 0 ? ( + {host.unreadRuns} + ) : snapshot.runs.length ? ( + {snapshot.runs.length} + ) : undefined, + }, + ]} + /> + +
+
+ +
+ {activeTab === "runs" && ( <> - · - - Auto-starts on login - + setRunFilter(v as "all" | "unread" | "needsInput")} - /> - {host.unreadRuns > 0 && ( - - )} - - )} -
+
+ +
+
+ {loadError && ( +
+ + {loadError} +
+ )} + + {host.bootServiceError && ( +
+ + {host.bootServiceError} +
+ )} + + {untrustedProject && ( +
+
+ + + This project is untrusted. Workspace automations stay paused until you trust the project. + +
+
+ )} -
{activeTab === "schedules" ? ( filteredAutomations.length === 0 ? (
@@ -550,20 +572,25 @@ export function AutomationsEditor({ {filteredAutomations.map((auto) => (
{ + if (el) rowRefs.current.set(auto.id, el); + else rowRefs.current.delete(auto.id); + }} data-testid={`automation-row-${auto.id}`} className={clsx(styles.row, focusAutomationId === auto.id && styles.rowFocused)} onContextMenu={(e) => showContextMenu(e, automationMenu(auto))} > -
+
-
+
+
+
{auto.name} {describeTrigger(auto.trigger, tx)} @@ -583,81 +610,80 @@ export function AutomationsEditor({ )}
-
{auto.prompt.text}
- {auto.nextRunOverrideMs != null && ( -
- - Next run override: - {" "} - {formatShortTimestamp(auto.nextRunOverrideMs)} - {auto.nextPromptOverride ? ` — “${auto.nextPromptOverride}”` : ""} -
- )} - {auto.pausedReason && ( -
- {auto.pausedReason} -
- )} -
- {providerName(auto.provider)} - · - - {auto.workspace.kind === "chatOnly" - ? tx("Chat only") - : auto.workspace.isolation === "worktree" - ? `${basename(auto.workspace.root)} · ${tx("Worktree")}` - : `${basename(auto.workspace.root)} · ${tx("Local checkout")}`} - - · - {auto.continuity === "sameTask" ? tx("Rolling session") : tx("Fresh session")} - {auto.enabled && auto.nextRunMs ? ( - <> - · - - {auto.nextRunOverrideMs != null ? Next (by agent): : Next:}{" "} - {formatShortTimestamp(auto.nextRunMs)} - - - ) : null} - {auto.maxRuns ? ( - <> - · - - {auto.runCount}/{auto.maxRuns} runs - - - ) : null} +
+ + void handleToggleEnabled(auto)} + /> + openAutomationDialog({ editing: auto })} + /> + showContextMenu(e, automationMenu(auto))} + />
-
- -
- - void handleToggleEnabled(auto)} - /> - openAutomationDialog({ editing: auto })} - /> - showContextMenu(e, automationMenu(auto))} - /> +
{auto.prompt.text}
+ {auto.nextRunOverrideMs != null && ( +
+ + Next run override: + {" "} + {formatShortTimestamp(auto.nextRunOverrideMs)} + {auto.nextPromptOverride ? ` — “${auto.nextPromptOverride}”` : ""} +
+ )} + {auto.pausedReason && ( +
+ {auto.pausedReason} +
+ )} +
+ {providerName(auto.provider)} + · + + {auto.workspace.kind === "chatOnly" + ? tx("Chat only") + : auto.workspace.isolation === "worktree" + ? `${basename(auto.workspace.root)} · ${tx("Worktree")}` + : `${basename(auto.workspace.root)} · ${tx("Local checkout")}`} + + · + {auto.continuity === "sameTask" ? tx("Rolling session") : tx("Fresh session")} + {auto.enabled && auto.nextRunMs ? ( + <> + · + + {auto.nextRunOverrideMs != null ? Next (by agent): : Next:}{" "} + {formatShortTimestamp(auto.nextRunMs)} + + + ) : null} + {auto.maxRuns ? ( + <> + · + + {auto.runCount}/{auto.maxRuns} runs + + + ) : null} +
))} @@ -686,9 +712,11 @@ export function AutomationsEditor({ className={styles.row} onClick={() => void handleOpenRun(run)} > -
+
-
+
+
+
{run.automationName} #{run.runNumber} @@ -710,58 +738,57 @@ export function AutomationsEditor({ )}
- {run.error && ( -
- {run.error} -
- )} -
- {formatShortTimestamp(run.startedMs)} - · - {run.origin.kind === "manual" ? tx("Manual run") : tx("Scheduled run")} - {run.branch && ( - <> - · - {run.branch} - +
e.stopPropagation()}> + {run.unread && ( + void backend.markRead(run.id, null).then(() => refreshAutomations(backend))} + /> )} - {(run.added > 0 || run.removed > 0) && ( - <> - · - +{run.added} - -{run.removed} - - )} - {run.worktreeCleaned && ( - <> - · - - Zero-diff worktree cleaned - - + {run.taskId && ( + )}
-
- -
e.stopPropagation()}> - {run.unread && ( - void backend.markRead(run.id, null).then(() => refreshAutomations(backend))} - /> - )} - {run.taskId && ( - + {run.error && ( +
+ {run.error} +
)} +
+ {formatShortTimestamp(run.startedMs)} + · + {run.origin.kind === "manual" ? tx("Manual run") : tx("Scheduled run")} + {run.branch && ( + <> + · + {run.branch} + + )} + {(run.added > 0 || run.removed > 0) && ( + <> + · + +{run.added} + -{run.removed} + + )} + {run.worktreeCleaned && ( + <> + · + + Zero-diff worktree cleaned + + + )} +
))} {snapshot.runsNextCursor != null && ( -
+
@@ -770,17 +797,19 @@ export function AutomationsEditor({
)}
+
- {activeTab === "schedules" && ( -
+ {activeTab === "schedules" && ( +
+
void handleToggleAutoStart(v)} label="Keep automations running when OpenIDEA is closed" />
- )} -
+ + )} ): { afterEach(() => { closeAutomationDialog(); setAutomationsTab("schedules"); - useAutomations.setState({ loaded: false, snapshot: structuredClone(EMPTY_AUTOMATION_SNAPSHOT) }); + useAutomations.setState({ + loaded: false, + focusAutomationId: null, + focusSeq: 0, + snapshot: structuredClone(EMPTY_AUTOMATION_SNAPSHOT), + }); useAgents.setState({ providers: [], modelCatalogs: new Map(), @@ -974,4 +979,47 @@ describe("Agent Automations model & UI", () => { ), ); }); + + it("resets scroll position on tab switch and scrolls focused schedule rows into view", async () => { + const now = Date.now(); + const automations: AgentAutomation_Serialize[] = Array.from({ length: 6 }, (_, i) => ({ + id: `auto-${i + 1}`, + name: `Schedule ${i + 1}`, + enabled: true, + prompt: { text: `Run task ${i + 1}`, files: [], images: [] }, + workspace: { kind: "chatOnly" }, + continuity: "newTask", + provider: "claude", + config: [], + permissions: "assisted", + trigger: { kind: "daily", hour: 9 + i, minute: 0, timeZone: "UTC" }, + allowAgentSchedule: false, + nextRunMs: now + (i + 1) * 3_600_000, + runCount: 0, + unreadRuns: 0, + createdMs: now - 10_000, + updatedMs: now - 10_000, + })); + const { backend } = makeMockBackend({ automations }); + render(); + await waitFor(() => expect(screen.getByTestId("automation-row-auto-6")).toBeTruthy()); + + const targetRow = screen.getByTestId("automation-row-auto-6"); + const scrollIntoView = vi.fn(); + targetRow.scrollIntoView = scrollIntoView; + + useAutomations.setState((s) => ({ focusAutomationId: "auto-6", focusSeq: s.focusSeq + 1 })); + await waitFor(() => expect(scrollIntoView).toHaveBeenCalledTimes(1)); + expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest" }); + + // Re-focusing the same schedule increments focusSeq and scrolls again. + useAutomations.setState((s) => ({ focusAutomationId: "auto-6", focusSeq: s.focusSeq + 1 })); + await waitFor(() => expect(scrollIntoView).toHaveBeenCalledTimes(2)); + + // Switching tabs resets scrollTop on the dedicated scroll body. + const scrollBody = screen.getByTestId("automations-scroll-body"); + scrollBody.scrollTop = 240; + setAutomationsTab("runs"); + await waitFor(() => expect(scrollBody.scrollTop).toBe(0)); + }); }); diff --git a/src/features/agents/automationsModel.ts b/src/features/agents/automationsModel.ts index 57f5c2f0e9..e66ef6f08c 100644 --- a/src/features/agents/automationsModel.ts +++ b/src/features/agents/automationsModel.ts @@ -674,6 +674,7 @@ interface AutomationsState { snapshot: AutomationSnapshot_Serialize; activeTab: "schedules" | "runs"; focusAutomationId: string | null; + focusSeq: number; automatedRunFilter: AutomatedRunFilter; dialog: AutomationDialogRequest; } @@ -684,6 +685,7 @@ export const useAutomations = create(() => ({ snapshot: EMPTY_AUTOMATION_SNAPSHOT, activeTab: "schedules", focusAutomationId: null, + focusSeq: 0, automatedRunFilter: typeof window === "undefined" ? "attention" : readStoredFilter(), dialog: { open: false, @@ -712,6 +714,7 @@ export function openAutomations(opts?: { tab?: "schedules" | "runs"; automationI useAutomations.setState((s) => ({ activeTab: opts.tab ?? s.activeTab, focusAutomationId: opts.automationId ?? null, + focusSeq: opts.automationId ? s.focusSeq + 1 : s.focusSeq, })); } void editorService().openInput({