Skip to content

Commit 7aec4cf

Browse files
committed
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.
1 parent 962df86 commit 7aec4cf

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
897897
useMount(() => textAreaRef.current?.focus())
898898

899899
const visibleMessages = useMemo(() => {
900-
const currentMessageCount = modifiedMessages.length
901-
const startIndex = Math.max(0, currentMessageCount - 500)
902-
const recentMessages = modifiedMessages.slice(startIndex)
903-
904-
const newVisibleMessages = recentMessages.filter((message: ClineMessage) => {
900+
// Remove the 500-message limit to prevent array index shifting
901+
// Virtuoso handles virtualization efficiently for large lists
902+
const newVisibleMessages = modifiedMessages.filter((message: ClineMessage) => {
905903
if (everVisibleMessagesTsRef.current.has(message.ts)) {
906904
const alwaysHiddenOnceProcessedAsk: ClineAsk[] = [
907905
"api_req_failed",

0 commit comments

Comments
 (0)