diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 9b8c96dea1d..5abd2a33464 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -181,8 +181,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction>( new LRUCache({ - max: 100, - ttl: 1000 * 60 * 5, + max: 200, + ttl: 1000 * 60 * 10, }), ) const autoApproveTimeoutRef = useRef(null) @@ -897,11 +897,14 @@ const ChatViewComponent: React.ForwardRefRenderFunction textAreaRef.current?.focus()) const visibleMessages = useMemo(() => { + // Use a more conservative approach for message filtering to prevent jumping + // Only apply the 500 message limit for very long conversations const currentMessageCount = modifiedMessages.length - const startIndex = Math.max(0, currentMessageCount - 500) - const recentMessages = modifiedMessages.slice(startIndex) + const shouldLimitMessages = currentMessageCount > 1000 + const startIndex = shouldLimitMessages ? Math.max(0, currentMessageCount - 750) : 0 + const messagesToProcess = modifiedMessages.slice(startIndex) - const newVisibleMessages = recentMessages.filter((message: ClineMessage) => { + const newVisibleMessages = messagesToProcess.filter((message: ClineMessage) => { if (everVisibleMessagesTsRef.current.has(message.ts)) { const alwaysHiddenOnceProcessedAsk: ClineAsk[] = [ "api_req_failed", @@ -954,7 +957,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction everVisibleMessagesTsRef.current.set(msg.ts, true)) @@ -1870,7 +1876,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction {