refactor(ui-tui): clean touched resize and sticky prompt paths

Trim comment noise, remove redundant typing, normalize sticky prompt viewport args to top→bottom order, and reuse one sticky viewport helper instead of duplicating the math.
This commit is contained in:
Brooklyn Nicholson 2026-04-23 14:37:00 -05:00
parent 9a885fba31
commit 9bf6e1cd6e
5 changed files with 23 additions and 32 deletions

View file

@ -22,7 +22,7 @@ import type { Msg, PanelSection, SlashCatalog } from '../types.js'
import { createGatewayEventHandler } from './createGatewayEventHandler.js'
import { createSlashHandler } from './createSlashHandler.js'
import { type AppLayoutProgressProps, type GatewayRpc, type TranscriptRow } from './interfaces.js'
import { type GatewayRpc, type TranscriptRow } from './interfaces.js'
import { $overlayState, patchOverlayState } from './overlayStore.js'
import { turnController } from './turnController.js'
import { $turnState, patchTurnState } from './turnStore.js'
@ -672,16 +672,11 @@ export function useMainApp(gw: GatewayClient) {
return top + vp >= total - 3
})()
const liveProgress = useMemo<AppLayoutProgressProps>(
() => ({ ...turn, showProgressArea, showStreamingArea: Boolean(turn.streaming) }),
[turn, showProgressArea]
)
const liveProgress = useMemo(() => ({ ...turn, showProgressArea, showStreamingArea: Boolean(turn.streaming) }), [turn, showProgressArea])
const frozenProgressRef = useRef(liveProgress)
// When the live tail is offscreen, freeze its snapshot so scroll work doesn't
// keep rebuilding the streaming/thinking subtree the user can't see. Thaw as
// soon as the viewport comes back near the bottom or the turn finishes.
// Freeze the offscreen live tail so scroll doesn't rebuild unseen streaming UI.
if (liveTailVisible || !ui.busy) {
frozenProgressRef.current = liveProgress
}