iterate.com / ui

git clone https://git.iterate.com/repos/ui

Virtual log: take the row memo out again (#8 showed no gain)

Measured on the live Dash with /repos/chat perf/scroll-check.mjs, 28 Nov 2026: the
Context Explorer's frames over 50 ms on the way down were 20 of 603 before #8 and
17 of 627 with it; the agent feed's on the way up 11-12 before and 13-15 with it.
The cost is not in calling renderRow again. The memo also made words that a row
computes from the clock at render refresh later. So it goes.

Session: claude e7bfeefe-1067-494b-8f63-82177cb1beb9 on beelink
Via: /agents/claude/dash-scroll-stability-mwzlcham-9677dd

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158EjAGDfCugWqZ9a2JTTgL

Jonas Templestein, 2026-11-28 01:31 UTC · 1b56f5fc7825857c85ef95d12592d1dd4b903c8b · parent a633bd0

1 file changed

M src/components/virtual-log/virtual-log.tsx
@@ -42,15 +42,7 @@
 // Vertical breathing room is `paddingStart` and `paddingEnd`, not wrapper padding the virtualizer
 // cannot see. A row's spacing is padding, not margin, and a row renders its real height at once (no
 // deferred content): the first measurement is the one the anchor trusts.
-import {
-  memo,
-  useCallback,
-  useEffect,
-  useLayoutEffect,
-  useRef,
-  useState,
-  type ReactNode,
-} from "react";
+import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";
 import { ArrowDownIcon, ArrowUpIcon } from "lucide-react";
 import {
   elementScroll,
@@ -274,15 +266,9 @@
                 ref={virtualizer.measureElement}
                 className="absolute top-0 left-0 w-full"
               >
-                {virtualItem.index < rows.length ? (
-                  <LogRow
-                    row={rows[virtualItem.index]!}
-                    index={virtualItem.index}
-                    renderRow={renderRow as RenderRow}
-                  />
-                ) : (
-                  visibleTail
-                )}
+                {virtualItem.index < rows.length
+                  ? renderRow(rows[virtualItem.index]!, virtualItem.index)
+                  : visibleTail}
               </div>
             ))}
           </div>
@@ -360,25 +346,6 @@
     </ScrollBubble>
   );
 }
-
-type RenderRow = (row: unknown, index: number) => ReactNode;
-/** A ROW THAT IS DRAWN IS NOT DRAWN AGAIN WHEN THE DRAWN WINDOW MOVES. The list renders at each
- *  change of its window (a scroll that brings one row in), and it called `renderRow` for every
- *  row of the window each time: about 155 rows in the Context Explorer, where 20 of 600 frames on
- *  the way down were over 50 ms (28 Nov 2026). A row renders again when its row, its index or
- *  the caller's `renderRow` changes: so a caller whose rows read other state gives a new
- *  `renderRow` when that state changes (a `useCallback` with its dependencies, or no memo). */
-const LogRow = memo(function LogRow({
-  row,
-  index,
-  renderRow,
-}: {
-  row: unknown;
-  index: number;
-  renderRow: RenderRow;
-}) {
-  return renderRow(row, index);
-});
 
 type LayoutSnapshot = {
   rows: readonly unknown[];