fix: fixed issues with scrolling jumps

This commit is contained in:
Bohdan Triapitsyn
2026-04-05 22:14:09 +03:00
parent f2f57ca281
commit 8b41a620d9
@@ -67,7 +67,6 @@ const VIEWPORT_ANCHOR_MIN_UPDATE_MS = 150;
export const useChatScrollManager = ({ export const useChatScrollManager = ({
currentSessionId, currentSessionId,
sessionMessageCount, sessionMessageCount,
streamingMessageId,
updateViewportAnchor, updateViewportAnchor,
isSyncing, isSyncing,
isMobile, isMobile,
@@ -149,13 +148,12 @@ export const useChatScrollManager = ({
}, [markProgrammaticScroll, scrollEngine]); }, [markProgrammaticScroll, scrollEngine]);
const scrollPinnedToBottom = React.useCallback(() => { const scrollPinnedToBottom = React.useCallback(() => {
if (streamingMessageId) { // Auto-follow should not animate across an entire new turn.
scrollToBottomInternal({ followBottom: true }); // Keep explicit user-triggered scrolls animated, but snap pinned
return; // updates so a new user/assistant message does not visibly travel
} // from the previous sticky header down to the tail.
scrollToBottomInternal({ instant: true }); scrollToBottomInternal({ instant: true });
}, [scrollToBottomInternal, streamingMessageId]); }, [scrollToBottomInternal]);
const updateScrollButtonVisibility = React.useCallback(() => { const updateScrollButtonVisibility = React.useCallback(() => {
const container = scrollRef.current; const container = scrollRef.current;