fix(tui): tighten /resume render, follow-up to 42721dbe

- useVirtualHistory: track last-seen ScrollBox metrics in a ref inside
  the post-layout effect and bump ver when sticky/top/vp change — the
  subscribe-based rearm was sufficient for fresh clicks but not for the
  "hydrated mid-commit, measured empty, then metrics settle" path where
  nothing re-triggered the hook until the next unrelated keystroke
- useSessionLifecycle: resume scrollToBottom from queueMicrotask to
  setTimeout(..., 0) so the fresh transcript has a full task turn to
  commit + measure before we try to land at the newest content
This commit is contained in:
Brooklyn Nicholson 2026-04-17 11:33:14 -05:00
parent 00591e3801
commit f53250b5e1
2 changed files with 22 additions and 2 deletions

View file

@ -186,7 +186,7 @@ export function useSessionLifecycle(opts: UseSessionLifecycleOptions) {
status: 'ready',
usage: usageFrom(r.info ?? null)
})
queueMicrotask(() => scrollRef.current?.scrollToBottom())
setTimeout(() => scrollRef.current?.scrollToBottom(), 0)
})
.catch((e: Error) => {
sys(`error: ${e.message}`)