@devries-cameron20 / t3code-1 / commits / 89c2a5c4dd
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(client-runtime): expanding deferred work skips an unused timeline rebuild (#29114)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Andrei committed Nov 3, 2026 at 09:38 UTC 89c2a5c4dd8cc6d9b994d95da5d87ef9f863f798
1 file changed +6 -4
packages/client-runtime/src/state/threadHistoryMerge.ts
+6 -4
@@ -112,10 +112,7 @@ export function mergeOlderHistoryIntoProjection(
112 turnItemById.set(String(row.sourceItemId), row.item);
113 }
114 if (page.length === 0 && work === undefined) return projection;
115 - let visible = [
116 - ...page,
117 - ...projection.visibleTurnItems.filter((row) => !pageKeys.has(projectedItemKey(row))),
118 - ];
115 + let visible: OrchestrationV2ProjectedTurnItem[];
116 if (work && anchor && deferred) {
117 let end = start + 1;
118 while (end < projection.visibleTurnItems.length) {
@@ -147,6 +144,11 @@ export function mergeOlderHistoryIntoProjection(
144 ...projection.visibleTurnItems.slice(end),
145 ];
146 if (anchor.visibility === "local") turnItemById.set(String(updated.item.id), updated.item);
147 + } else {
148 + visible = [
149 + ...page,
150 + ...projection.visibleTurnItems.filter((row) => !pageKeys.has(projectedItemKey(row))),
151 + ];
152 }
153 if (
154 visible.length === projection.visibleTurnItems.length &&