mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
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.
This commit is contained in:
parent
a65072e022
commit
0541006d33
1 changed files with 4 additions and 15 deletions
|
|
@ -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<string, number>()
|
||||
|
||||
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<HTMLDivElement, HTMLDivElement>({
|
||||
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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue