From d210d0e44e147e20f5d54241c3f00d1987bb68ec Mon Sep 17 00:00:00 2001 From: "dayuan.jiang" Date: Fri, 10 Apr 2026 10:56:52 +0900 Subject: [PATCH] fix: add trailing edge to scroll throttle Ensures the chat scrolls to the bottom after streaming ends, even if the last messages update arrives during the 150ms throttle window. --- components/chat-message-display.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/chat-message-display.tsx b/components/chat-message-display.tsx index 717296d..ada6ae5 100644 --- a/components/chat-message-display.tsx +++ b/components/chat-message-display.tsx @@ -432,10 +432,14 @@ export function ChatMessageDisplay({ } // Throttle scroll during streaming to avoid layout thrashing + // Leading + trailing: scroll immediately, then once more after cooldown if (!scrollThrottleRef.current) { messagesEndRef.current.scrollIntoView({ behavior: "smooth" }) scrollThrottleRef.current = setTimeout(() => { scrollThrottleRef.current = null + messagesEndRef.current?.scrollIntoView({ + behavior: "smooth", + }) }, 150) } }