Compare commits

...

1 Commits

Author SHA1 Message Date
d34e8e2c6d Fix jump-to-bottom button broken during active terminal output
All checks were successful
Build App / compute-version (push) Successful in 6s
Build App / build-macos (push) Successful in 2m21s
Build App / build-windows (push) Successful in 3m4s
Build App / build-linux (push) Successful in 5m31s
Build App / create-tag (push) Successful in 3s
Build App / sync-to-github (push) Successful in 11s
The shouldFollow flag was captured before term.write() but the callback
ran asynchronously — if the user scrolled up in between, the stale flag
forced the viewport back to bottom, preventing the button from appearing.

Check isAtBottomRef at callback time instead so user scroll-up is respected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 21:35:58 -07:00

View File

@@ -197,13 +197,12 @@ export default function TerminalView({ sessionId, active }: Props) {
const outputPromise = onOutput(sessionId, (data) => {
if (aborted) return;
const shouldFollow = isAtBottomRef.current;
term.write(data, () => {
// Keep viewport pinned to bottom when user hasn't scrolled up
if (shouldFollow) {
// Keep viewport pinned to bottom when user hasn't scrolled up.
// Check ref at callback time (not capture time) so that a user
// scroll-up between the write() call and callback is respected.
if (isAtBottomRef.current) {
term.scrollToBottom();
isAtBottomRef.current = true;
setIsAtBottom(true);
}
});
detector.feed(data);