diff options
| author | Luke Parker <[email protected]> | 2026-03-17 12:55:58 +1000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-17 12:55:58 +1000 |
| commit | e416e59ea69f7600acbdb593ba68ac0fb1ee2633 (patch) | |
| tree | f1594d949fc3ad0d37f871e3d1028fcc77674035 /packages/app/src/pages | |
| parent | cb69501098c603ccd7d3e3dbe6655d401c1d815c (diff) | |
| download | opencode-e416e59ea69f7600acbdb593ba68ac0fb1ee2633.tar.gz opencode-e416e59ea69f7600acbdb593ba68ac0fb1ee2633.zip | |
test(app): deflake slash terminal toggle flow (#17881)
Diffstat (limited to 'packages/app/src/pages')
| -rw-r--r-- | packages/app/src/pages/session/terminal-panel.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/app/src/pages/session/terminal-panel.tsx b/packages/app/src/pages/session/terminal-panel.tsx index e78ebecfc..d62d91c19 100644 --- a/packages/app/src/pages/session/terminal-panel.tsx +++ b/packages/app/src/pages/session/terminal-panel.tsx @@ -18,8 +18,10 @@ import { terminalTabLabel } from "@/pages/session/terminal-label" import { createSizing, focusTerminalById } from "@/pages/session/helpers" import { getTerminalHandoff, setTerminalHandoff } from "@/pages/session/handoff" import { useSessionLayout } from "@/pages/session/session-layout" +import { terminalProbe } from "@/testing/terminal" export function TerminalPanel() { + const delays = [120, 240] const layout = useLayout() const terminal = useTerminal() const language = useLanguage() @@ -79,16 +81,20 @@ export function TerminalPanel() { ) const focus = (id: string) => { + const probe = terminalProbe(id) + probe.focus(delays.length + 1) focusTerminalById(id) const frame = requestAnimationFrame(() => { + probe.step() if (!opened()) return if (terminal.active() !== id) return focusTerminalById(id) }) - const timers = [120, 240].map((ms) => + const timers = delays.map((ms) => window.setTimeout(() => { + probe.step() if (!opened()) return if (terminal.active() !== id) return focusTerminalById(id) @@ -96,6 +102,7 @@ export function TerminalPanel() { ) return () => { + probe.focus(0) cancelAnimationFrame(frame) for (const timer of timers) clearTimeout(timer) } |
