From 7aec4cf634126aaf221e8421a520473473c7413b Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 13 Aug 2025 17:52:05 +0000 Subject: [PATCH 1/2] fix: remove 500-message limit to prevent scrollbar jumping in long conversations Fixes #7052 The issue was caused by array index shifting when conversations exceeded 500 messages. Each new message would cause the oldest message to be dropped and all indices to shift, making Virtuoso lose track of the current scroll position. This fix removes the message limit entirely and lets Virtuoso handle virtualization of all messages efficiently, completely eliminating the index shifting problem. --- webview-ui/src/components/chat/ChatView.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 9b8c96dea1d..0b87a61deb8 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -897,11 +897,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction textAreaRef.current?.focus()) const visibleMessages = useMemo(() => { - const currentMessageCount = modifiedMessages.length - const startIndex = Math.max(0, currentMessageCount - 500) - const recentMessages = modifiedMessages.slice(startIndex) - - const newVisibleMessages = recentMessages.filter((message: ClineMessage) => { + // Remove the 500-message limit to prevent array index shifting + // Virtuoso handles virtualization efficiently for large lists + const newVisibleMessages = modifiedMessages.filter((message: ClineMessage) => { if (everVisibleMessagesTsRef.current.has(message.ts)) { const alwaysHiddenOnceProcessedAsk: ClineAsk[] = [ "api_req_failed", From 409024c31f3d4ba57d40eb9b004ba2a58f37947b Mon Sep 17 00:00:00 2001 From: Daniel <57051444+daniel-lxs@users.noreply.github.com> Date: Wed, 13 Aug 2025 13:00:25 -0500 Subject: [PATCH 2/2] chore: remove comment --- webview-ui/src/components/chat/ChatView.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 0b87a61deb8..97e8388fb8b 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -897,8 +897,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction textAreaRef.current?.focus()) const visibleMessages = useMemo(() => { - // Remove the 500-message limit to prevent array index shifting - // Virtuoso handles virtualization efficiently for large lists const newVisibleMessages = modifiedMessages.filter((message: ClineMessage) => { if (everVisibleMessagesTsRef.current.has(message.ts)) { const alwaysHiddenOnceProcessedAsk: ClineAsk[] = [