From 17b038903bfaeaae31a2ec8532824b36e875d21a Mon Sep 17 00:00:00 2001 From: Entrpi Date: Sun, 8 Nov 2026 13:21:18 +1100 Subject: [PATCH] test(web): the streaming render scenario gives the timeline stable props The render scenarios count component renders so a change that re-renders more shows up in `scripts/render-metrics.ts compare`. The timeline scenarios passed new callbacks and arrays on every rerender, unlike ChatView, which keeps them stable. Those props reach every row through the timeline's shared row context, so each streamed delta re-rendered every row in the scenario on main too, and a change that made rows re-render on every update could not show up: the redesign's row-context regression (pingdotgg/t3code#32756) reported no change in stream-assistant-turn. - `timelineFor` builds the timeline's props once per mounted timeline, as it already did for the list handle. On main, stream-assistant-turn goes from 8,388 to 1,548 renders; the other scenarios are unchanged. With this scenario, the redesign branch before #32756 counts 4,983 and with it 1,533. User story: When a change makes the timeline re-render more while it streams, the render metrics say so before it ships. --- apps/web/test/renderScenarios.renders.tsx | 54 ++++++++++++----------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/apps/web/test/renderScenarios.renders.tsx b/apps/web/test/renderScenarios.renders.tsx index b8458881ce879..8cad678f29f00 100644 --- a/apps/web/test/renderScenarios.renders.tsx +++ b/apps/web/test/renderScenarios.renders.tsx @@ -85,36 +85,40 @@ const versionedProps = { onManualNavigation: () => {} }; // One list handle per mounted timeline, as ChatView keeps one: the timeline compares the // handle across renders, and a new one per render would skip its scroll-to-end and settle work. +// The callbacks and lists stay the same across renders too, as ChatView's do: new ones change +// the rows' shared context, which re-renders every row and hides a row that re-renders alone. function timelineFor() { - const listRef = createRef(); + const props: Omit = { + isWorking: false, + listRef: createRef(), + latestRun: null, + turnDiffSummaries: [], + runs: [], + onOpenTurnDiff: () => {}, + onOpenThread: () => {}, + onForkFromRun: async () => {}, + supportsConversationRollback: false, + onRevertToTurnCount: () => {}, + isRevertingCheckpoint: false, + onImageExpand: () => {}, + activeThreadEnvironmentId: ENVIRONMENT_ID, + markdownCwd: undefined, + resolvedTheme: "light", + timestampFormat: "locale", + workspaceRoot: undefined, + anchorMessageId: null, + onAnchorReady: () => {}, + onAnchorSizeChanged: () => {}, + contentInsetEndAdjustment: 0, + emptyPlaceholderInset: 0, + liveFollowEnabled: true, + onIsAtEndChange: () => {}, + }; return (thread: string, entries: Entry[]) => ( {}} - onOpenThread={() => {}} - onForkFromRun={async () => {}} - supportsConversationRollback={false} - onRevertToTurnCount={() => {}} - isRevertingCheckpoint={false} - onImageExpand={() => {}} - activeThreadEnvironmentId={ENVIRONMENT_ID} - markdownCwd={undefined} - resolvedTheme="light" - timestampFormat="locale" - workspaceRoot={undefined} - anchorMessageId={null} - onAnchorReady={() => {}} - onAnchorSizeChanged={() => {}} - contentInsetEndAdjustment={0} - emptyPlaceholderInset={0} - liveFollowEnabled - onIsAtEndChange={() => {}} {...versionedProps} /> );