Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(llm): use instant scrolling for streaming as well
Elian Doran14ec83ef41e6
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.tsindex 9e42d6345e..6abe534a2e 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts+++ b/apps/client/src/widgets/type_widgets/llm_chat/useLlmChat.ts@@ -166,20 +166,17 @@ export function useLlmChat(}, []);// Scroll to bottom when content changes, but only if user hasn't scrolled away.- // Use instant scroll for message changes (includes initial load), smooth for streaming.- const scrollToBottom = useCallback((behavior: ScrollBehavior = "smooth") => {+ // Always use instant scroll — smooth animations race with the scroll listener+ // during streaming, causing the auto-scroll to "unstick" mid-animation.+ const scrollToBottom = useCallback(() => {if (isNearBottomRef.current) {- messagesEndRef.current?.scrollIntoView({ behavior });+ messagesEndRef.current?.scrollIntoView({ behavior: "instant" });}}, []);- useEffect(() => {- scrollToBottom("instant");- }, [messages, scrollToBottom]);-useEffect(() => {scrollToBottom();- }, [streamingContent, streamingThinking, scrollToBottom]);+ }, [messages, streamingContent, streamingThinking, scrollToBottom]);// Load state from content objectconst loadFromContent = useCallback((content: LlmChatContent) => {