fix(tui): preserve subagent list position (#39156)

Co-authored-by: Kit Langton <kit.langton@gmail.com>
This commit is contained in:
opencode-agent[bot] 2026-07-27 14:08:00 -04:00 committed by GitHub
commit f5700808c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,7 +103,8 @@ export function SubagentsTab(props: { sessionID: string }) {
setStore("selected", next)
const scrollCurrentIntoView = () => scrollToIndex(next, true)
scrollCurrentIntoView()
requestAnimationFrame(scrollCurrentIntoView)
// The remounted scrollbox finishes layout on the next frame and resets its scroll position.
requestAnimationFrame(() => requestAnimationFrame(scrollCurrentIntoView))
}
wasActive = true
if (store.selected >= list.length) moveTo(Math.max(0, list.length - 1))