[Fix] Chat window runs out of memory when transcript grows large#153
Draft
roomote[bot] wants to merge 1 commit into
Draft
[Fix] Chat window runs out of memory when transcript grows large#153roomote[bot] wants to merge 1 commit into
roomote[bot] wants to merge 1 commit into
Conversation
Contributor
Author
|
3 items outstanding: 1 code finding and 2 checks still pending. Action required. See task
|
| ], | ||
| ) | ||
|
|
||
| const computeMessageKey = useCallback((_index: number, messageOrGroup: ClineMessage) => messageOrGroup.ts, []) |
Contributor
Author
There was a problem hiding this comment.
ts is not unique in this codebase, so using it as the sole Virtuoso item key will collide on supported histories. We already have coverage for identical-timestamp transcripts in src/core/webview/__tests__/ClineProvider.spec.ts, and when that data hits this list React will reuse a row for multiple messages instead of keeping them distinct.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
Do not merge this PR, it's not ready for review, the bug needs to be replicated and then tested with this pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem this solves
Fixes an issue where users can hit heavy memory pressure in the chat window as long transcripts grow, which can eventually leave the UI in a gray-screen failure state.
Why this change was made
The chat list was already using
react-virtuoso, but it was still pre-rendering a large amount of off-screen transcript content. This change tightens the off-screen render buffer, gives the virtualized list a stable item key, and provides a default row height so large transcripts keep less rich content mounted outside the viewport.User impact
Large chat transcripts keep less text and markdown mounted when they are off screen. That should lower memory usage in long-running sessions and reduce the chances of the gray-screen failure when the transcript gets large.