Skip to content

Conversation

@roblourens
Copy link
Member

Ensure that the maps in the renderer like codeBlocksByEditorUri get cleared (surely these can go away somehow)

Mainly get rid of preceedingContentParts, I don't think this really fixes the issue since the getters on the context still retain a ref but it wasn't used anywhere else so might as well clean it up

Copilot AI review requested due to automatic review settings January 11, 2026 23:18
@roblourens roblourens enabled auto-merge (squash) January 11, 2026 23:18
@roblourens roblourens self-assigned this Jan 11, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses potential memory leaks in the chat renderer by clearing maps when the view model changes and removing unnecessary object references that could prevent garbage collection.

Changes:

  • Clear renderer maps (codeBlocksByEditorUri, codeBlocksByResponseId, fileTreesByResponseId, focusedFileTreesByResponseId) when view model is updated
  • Remove preceedingContentParts from context interface and use local variables instead to avoid retaining references
  • Extract element from context in ChatCollapsibleContentPart to avoid storing the entire context object

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
chatListRenderer.ts Add map clearing in updateViewModel, remove preceedingContentParts from context objects, add treeStartIndex getter, and call clearRenderedParts in disposeTemplate
chatTreeContentPart.ts Remove unused constructor parameters (element, treeDataIndex) and reorder imports
chatThinkingContentPart.ts Replace this.context.element with this.element to use the extracted field
chatReferencesContentPart.ts Replace this.context.element with this.element to use the extracted field
chatContentParts.ts Remove preceedingContentParts property and add treeStartIndex property to interface
chatCollapsibleContentPart.ts Extract element from context and store it as a field instead of storing the entire context object

@roblourens roblourens merged commit c664b45 into main Jan 11, 2026
27 of 28 checks passed
@roblourens roblourens deleted the roblou/obliged-asp branch January 11, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants