Skip to content

Conversation

@roblourens
Copy link
Member

We fire onDidChange to trigger a rerender to apply a css class. When onDidChange happens and the response is complete, then we update all the codeblock textmodels (?). Use an observable to avoid all this. #286660

fyi @justschen

We fire onDidChange to trigger a rerender to apply a css class. When onDidChange happens and the response is complete, then we update all the codeblock textmodels (?). Use an observable to avoid all this. #286660
Copilot AI review requested due to automatic review settings January 10, 2026 19:51
@roblourens roblourens enabled auto-merge (squash) January 10, 2026 19:52
@roblourens roblourens self-assigned this Jan 10, 2026
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 10, 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 refactors the shouldBeBlocked property from a plain boolean to an IObservable<boolean> to avoid unnecessary work when putting requests into edit mode. Previously, changes to this property required firing onDidChange events to trigger re-renders for applying CSS classes. By using observables, the UI can reactively update only when the property changes, eliminating unnecessary work such as updating codeblock text models when responses are complete.

Changes:

  • Changed shouldBeBlocked from boolean to IObservable<boolean> in interfaces and implementations
  • Added setShouldBeBlocked() method to IChatRequestModel for updating the observable value
  • Removed shouldBeBlocked from the render key in chatWidget.ts diffIdentityProvider
  • Updated chatListRenderer.ts to use autorun for reactive CSS class updates based on the observable

Reviewed changes

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

File Description
src/vs/workbench/contrib/chat/common/model/chatViewModel.ts Updated interfaces to change shouldBeBlocked from optional boolean to IObservable<boolean>
src/vs/workbench/contrib/chat/common/model/chatModel.ts Implemented observable pattern for shouldBeBlocked, added setter method, removed onDidChange event firing for this property
src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts Removed shouldBeBlocked from render identity calculation and updated one usage to call setShouldBeBlocked()
src/vs/workbench/contrib/chat/browser/widget/chatListRenderer.ts Added autorun to reactively update disabled overlay CSS class based on observable changes

@roblourens roblourens merged commit 86db4eb into main Jan 10, 2026
27 of 28 checks passed
@roblourens roblourens deleted the roblou/youthful-bobolink branch January 10, 2026 22:01
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