From 0541006d33cc4622a285e1cf80d190857118edc0 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 21 Oct 2026 09:21:06 -0700 Subject: [PATCH] perf(app): stop reading the header height on every timeline resize The timeline read --session-header-height with getComputedStyle each time its width changed, every frame of a sidebar toggle. Nothing defines that property since the 80px header went away, so the read always fell back to 48px. The scroll padding now uses that fixed height. --- .../app/src/session/timeline/virtualizer.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/app/src/session/timeline/virtualizer.tsx b/packages/app/src/session/timeline/virtualizer.tsx index 274b8f1df63..57a558ee4ec 100644 --- a/packages/app/src/session/timeline/virtualizer.tsx +++ b/packages/app/src/session/timeline/virtualizer.tsx @@ -279,11 +279,11 @@ export function createTimelineVirtualizer(input: Input) { let deferredTop: number | undefined let precommittedTop: number | undefined let flushScrollFrame: (() => void) | undefined - let lastHeaderWidth: number | undefined // Sizes held back from rows still streaming, applied once their text completes. const shrinks = new Map() - const [headerHeight, setHeaderHeight] = createSignal(48) + // The session header is a fixed 48px, the same fallback --sticky-accordion-top uses. + const headerHeight = 48 const virtualizer = createVirtualizer({ get count() { @@ -296,18 +296,7 @@ export function createTimelineVirtualizer(input: Input) { reportRect = (rect) => { const widthChanged = Math.abs(rect.width - (instance.scrollRect?.width ?? 0)) >= 1 if (widthChanged) rewrap() - const height = Math.max(0, rect.height - bottomInset()) - const root = listRoot() - batch(() => { - // The container-responsive header can be 48px or 80px; the composer covers the viewport's bottom edge. - if (root && (widthChanged || lastHeaderWidth !== rect.width)) { - lastHeaderWidth = rect.width - setHeaderHeight( - parseFloat(getComputedStyle(root).getPropertyValue("--session-header-height")) || 48, - ) - } - callback({ width: rect.width, height }) - }) + callback({ width: rect.width, height: Math.max(0, rect.height - bottomInset()) }) } return observeElementRect(instance, (rect) => { @@ -435,7 +424,7 @@ export function createTimelineVirtualizer(input: Input) { paddingEnd: tailSize, // Revealed prompts sit below the solid header and its 16px fade. get scrollPaddingStart() { - return input.showHeader() ? headerHeight() + 16 : 0 + return input.showHeader() ? headerHeight + 16 : 0 }, get rangeExtractor() { return rangeExtractor()