Skip to content

Commit f78603a

Browse files
committed
fix(frontend): clear stale global search results in command palette
1 parent 17844da commit f78603a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

frontend/src/components/CommandPalette.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function CommandPalette() {
3636
taxonomy: { label: "TAXONOMY", hint: "Jump into category clusters", shortcut: "Alt+3" },
3737
} as const;
3838
const { agents, wikiPages, setSelectedAgent, setIntelTab } = useSimulationStore();
39-
const { searchResults, searching, globalSearch } = useMultiverseStore();
39+
const { searchResults, searching, globalSearch, setGlobalSearchResults } = useMultiverseStore();
4040
const { rootNodes, fetchTree } = useTaxonomyStore();
4141
const shortcutLabel = useMemo(() => {
4242
if (typeof navigator !== "undefined" && /mac/i.test(navigator.platform)) {
@@ -132,7 +132,11 @@ export function CommandPalette() {
132132
const timer = setTimeout(() => globalSearch(query), 300);
133133
return () => clearTimeout(timer);
134134
}
135-
}, [query, mode, globalSearch]);
135+
136+
if (mode === "global") {
137+
setGlobalSearchResults([]);
138+
}
139+
}, [query, mode, globalSearch, setGlobalSearchResults]);
136140

137141
// Fetch taxonomy when mode changes
138142
useEffect(() => {

frontend/src/stores/multiverse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ interface MultiverseState {
7979
fetchWorldNeighbors: (worldId: string, minStrength?: number) => Promise<void>;
8080
fetchWorldMap: (minStrength?: number, minCount?: number) => Promise<void>;
8181
globalSearch: (query: string) => Promise<void>;
82+
setGlobalSearchResults: (results: GlobalSearchResult[]) => void;
8283
}
8384

8485
export const useMultiverseStore = create<MultiverseState>((set) => ({
@@ -161,4 +162,5 @@ export const useMultiverseStore = create<MultiverseState>((set) => ({
161162
set({ searching: false });
162163
}
163164
},
165+
setGlobalSearchResults: (results: GlobalSearchResult[]) => set({ searchResults: results }),
164166
}));

0 commit comments

Comments
 (0)