From b51c528613e36d08160fde2510ec54c470633390 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sun, 26 Apr 2026 21:37:43 -0500 Subject: [PATCH] fix(tui): address virtual row and perf log review notes Keep transcript row keys stable across capped-history trims and rename React Profiler timestamp fields so JSONL consumers don't confuse absolute timestamps with durations. --- ui-tui/src/app/useMainApp.ts | 5 +++-- ui-tui/src/lib/perfPane.tsx | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui-tui/src/app/useMainApp.ts b/ui-tui/src/app/useMainApp.ts index 2a8913b632..7dc3aae9be 100644 --- a/ui-tui/src/app/useMainApp.ts +++ b/ui-tui/src/app/useMainApp.ts @@ -133,6 +133,7 @@ export function useMainApp(gw: GatewayClient) { const historyItemsRef = useRef(historyItems) const lastUserMsgRef = useRef(lastUserMsg) const msgIdsRef = useRef(new WeakMap()) + const msgIdSeqRef = useRef(0) const heightCachesRef = useRef(new Map>()) colsRef.current = cols @@ -180,7 +181,7 @@ export function useMainApp(gw: GatewayClient) { return hit } - const next = messageHeightKey(msg) + const next = `${messageHeightKey(msg)}:${++msgIdSeqRef.current}` msgIdsRef.current.set(msg, next) @@ -188,7 +189,7 @@ export function useMainApp(gw: GatewayClient) { }, []) const virtualRows = useMemo( - () => historyItems.map((msg, index) => ({ index, key: `${index}:${messageId(msg)}`, msg })), + () => historyItems.map((msg, index) => ({ index, key: messageId(msg), msg })), [historyItems, messageId] ) diff --git a/ui-tui/src/lib/perfPane.tsx b/ui-tui/src/lib/perfPane.tsx index f363ea59c1..9d8bea5b8d 100644 --- a/ui-tui/src/lib/perfPane.tsx +++ b/ui-tui/src/lib/perfPane.tsx @@ -53,11 +53,11 @@ const onRender: ProfilerOnRenderCallback = (id, phase, actualMs, baseMs, startTi writeRow({ actualMs: round2(actualMs), baseMs: round2(baseMs), - commitMs: round2(commitTime), + commitTimeMs: round2(commitTime), id, phase, src: 'react', - startMs: round2(startTime), + startTimeMs: round2(startTime), ts: Date.now() }) }