Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(chat): prevent crash when conversation map is empty

Steven Enamakel868819feecc6
diff --git a/app/src/features/conversations/aui/ChatConversationMap.tsx b/app/src/features/conversations/aui/ChatConversationMap.tsx
index 940d5e9515..864c798526 100644
--- a/app/src/features/conversations/aui/ChatConversationMap.tsx
+++ b/app/src/features/conversations/aui/ChatConversationMap.tsx
@@ -133,9 +133,13 @@ export function ChatConversationMap({ children }: { children: ReactNode }) {
useFindShortcut(containerEl, () => setSearchOpen(true));
- useEffect(() => {
+ // Reset on the state change that invalidates the previous index, in the
+ // event handler that causes it — not in an effect keyed on `query`, which
+ // would run a second, avoidable render after the query's own.
+ const onQueryChange = useCallback((next: string) => {
+ setQuery(next);
setActiveIndex(0);
- }, [query]);
+ }, []);
useEffect(() => {
const hit = hits[activeIndex];