The best way to control Claude Code, Codex and more from any computer or phone
perf(web): reduce allocations in streaming timeline scans (#23739)
Utkarsh Patil committed
Oct 23, 2026 at 19:10 UTC
f7f02d779e1d068a1458bd64ffe2933950dc0f41
2 files changed
+4
-2
apps/web/src/components/chat/MessagesTimeline.logic.ts
+2
-1
@@ -2157,7 +2157,8 @@ function replaceStreamingMessageRows(
2157
return null;
2158
}
2159
const replacements = new Map<ChatMessage, Extract<TimelineEntry, { kind: "message" }>>();
2160
- for (const [index, entry] of timelineEntries.entries()) {
2160
+ for (let index = 0; index < timelineEntries.length; index += 1) {
2161
+ const entry = timelineEntries[index]!;
2162
const previousEntry = previousEntries[index]!;
2163
if (entry === previousEntry) continue;
2164
if (
apps/web/src/session-logic.ts
+2
-1
@@ -1005,7 +1005,8 @@ function reuseTimelineEntries(
1005
OrchestrationV2ProjectedTurnItem,
1006
OrchestrationV2ProjectedTurnItem
1007
>();
1008
- for (const [index, previousItem] of before.visibleTurnItems.entries()) {
1008
+ for (let index = 0; index < before.visibleTurnItems.length; index += 1) {
1009
+ const previousItem = before.visibleTurnItems[index]!;
1010
const item = input.visibleTurnItems[index]!;
1011
if (item === previousItem) continue;
1012
if (!isStreamingTurnItemTextUpdate(previousItem, item)) return null;