Skip to content

Commit 0c716be

Browse files
committed
perf(sidebar): use set for failed deletion lookup
1 parent d466b1c commit 0c716be

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

crates/agent-gateway/web/src/components/chat/ChatHistorySidebar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,8 @@ export const ChatHistorySidebar = memo(function ChatHistorySidebar(props: ChatHi
16791679
// Cancelled mid-batch: exitSelectionMode already reset the selection UI.
16801680
return;
16811681
}
1682-
const failedIds = result.failedIds.filter((id) => orderedConversationIds.includes(id));
1682+
const orderedConversationIdSet = new Set(orderedConversationIds);
1683+
const failedIds = result.failedIds.filter((id) => orderedConversationIdSet.has(id));
16831684
setSelectedConversationIds(new Set(failedIds));
16841685
selectionAnchorRef.current = failedIds[0] ?? null;
16851686
if (failedIds.length === 0) {

crates/agent-gui/src/components/chat/ChatHistorySidebar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,8 @@ export const ChatHistorySidebar = memo(function ChatHistorySidebar(props: ChatHi
12221222
// Cancelled mid-batch: exitSelectionMode already reset the selection UI.
12231223
return;
12241224
}
1225-
const failedIds = result.failedIds.filter((id) => orderedConversationIds.includes(id));
1225+
const orderedConversationIdSet = new Set(orderedConversationIds);
1226+
const failedIds = result.failedIds.filter((id) => orderedConversationIdSet.has(id));
12261227
setSelectedConversationIds(new Set(failedIds));
12271228
selectionAnchorRef.current = failedIds[0] ?? null;
12281229
if (failedIds.length === 0) {

0 commit comments

Comments
 (0)