Skip to content

Commit 2e420cf

Browse files
test(web): command palette tests clear a leaked last-used project
Browser test files share one origin's localStorage. A thread route rendered by an earlier file in the shard leaves t3code:last-used-project:v1 behind; with that unknown project remembered and no primary environment, the palette shows no "New thread in <project>" row, so ArrowDown skipped past "New thread in...". setup() now removes the key. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ee90bdc commit 2e420cf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎apps/web/src/components/CommandPalette.browser.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { page, userEvent } from "vite-plus/test/browser";
55
import { act, render } from "../../test/render";
66
import { openCommandPalette } from "../commandPaletteBus";
77
import { useCommandPaletteStore } from "../commandPaletteStore";
8+
import { LAST_USED_PROJECT_STORAGE_KEY } from "../hooks/useHandleNewThread";
9+
import { removeLocalStorageItem } from "../hooks/useLocalStorage";
810
import { makeThreadFixture } from "../test-fixtures";
911
import type { Project, Thread } from "../types";
1012
import { CommandPalette } from "./CommandPalette";
@@ -20,6 +22,9 @@ vi.mock("../state/entities", async (original) => ({
2022
}));
2123

2224
function setup(state: { projects?: ReadonlyArray<Project>; threads?: ReadonlyArray<Thread> } = {}) {
25+
// Earlier browser test files share this origin's localStorage; a remembered project
26+
// that is not listed here hides the default "New thread in <project>" row.
27+
removeLocalStorageItem(LAST_USED_PROJECT_STORAGE_KEY);
2328
useCommandPaletteStore.setState(useCommandPaletteStore.getInitialState(), true);
2429
entities.projects = state.projects ?? [];
2530
entities.threads = state.threads ?? [];

0 commit comments

Comments
 (0)