Skip to content

Commit f9e594f

Browse files
perf(seer-explorer): Use slice to avoid scanning entire blocks array
Start iteration from insertIndex+1 instead of checking every block.
1 parent dec9c98 commit f9e594f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

static/app/views/seerExplorer/hooks/useSeerExplorer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,9 @@ export const useSeerExplorer = () => {
461461
return undefined;
462462
}
463463

464-
const hasAssistantResponse = serverBlocks.some(
465-
(b, i) => i > optimistic.insertIndex && b.message.role === 'assistant'
466-
);
464+
const hasAssistantResponse = serverBlocks
465+
.slice(optimistic.insertIndex + 1)
466+
.some(b => b.message.role === 'assistant');
467467

468468
if (hasAssistantResponse) {
469469
setOptimistic(null);

0 commit comments

Comments
 (0)