diff --git a/packages/tui/src/routes/session/composer/subagents-tab.tsx b/packages/tui/src/routes/session/composer/subagents-tab.tsx index 4f3c976ddd..8a44b9f9ee 100644 --- a/packages/tui/src/routes/session/composer/subagents-tab.tsx +++ b/packages/tui/src/routes/session/composer/subagents-tab.tsx @@ -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))