From 43f1c54b43939e1161cd8449a5b675037edcc02e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 30 Oct 2026 17:15:31 -0700 Subject: [PATCH] fix(tui): stop stale session reads on leave and pin test theme --- packages/tui/src/app.tsx | 6 +++++- packages/tui/test/cli/tui/dialog-select.test.tsx | 2 +- packages/tui/test/prompt-cursor.test.tsx | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/tui/src/app.tsx b/packages/tui/src/app.tsx index b6c200f7d4a6..55877cd41d71 100644 --- a/packages/tui/src/app.tsx +++ b/packages/tui/src/app.tsx @@ -496,6 +496,10 @@ function App() { const config = useConfig() const devtools = createMemo(() => config.data.debug?.devtools ?? app.channel === "local") const route = useRoute() + // Keep the last session ID so a closing frame never reads a disposed accessor. + const routeSessionID = createMemo((previous) => + route.data.type === "session" ? route.data.sessionID : previous, + ) const dimensions = useTerminalDimensions() const renderer = useRenderer() const dialog = useDialog() @@ -1447,7 +1451,7 @@ function App() { {(sessionID) => ( )} diff --git a/packages/tui/test/cli/tui/dialog-select.test.tsx b/packages/tui/test/cli/tui/dialog-select.test.tsx index bda8e67a7c21..2f16e6cc4e04 100644 --- a/packages/tui/test/cli/tui/dialog-select.test.tsx +++ b/packages/tui/test/cli/tui/dialog-select.test.tsx @@ -387,7 +387,7 @@ test("matches the search cursor to the highlighted row until text is typed under () => {}, () => {}, undefined, - { experimental: { "new-designs": true } }, + { theme: { name: "opencode" }, experimental: { "new-designs": true } }, ) try { diff --git a/packages/tui/test/prompt-cursor.test.tsx b/packages/tui/test/prompt-cursor.test.tsx index 18b2f4997900..adbbe815f434 100644 --- a/packages/tui/test/prompt-cursor.test.tsx +++ b/packages/tui/test/prompt-cursor.test.tsx @@ -7,7 +7,7 @@ test("the prompt keeps a cursor style set on its textarea when the theme changes // Other app tests can leave a home draft in the process-wide stash. takeDraft(undefined) await using setup = await createAppFixture({ - config: { animations: false, keybinds: { "theme.switch_mode": "f6" } }, + config: { theme: { name: "opencode" }, animations: false, keybinds: { "theme.switch_mode": "f6" } }, }) await setup.ready await setup.waitForFrame((frame) => frame.includes("commands"))