Ensure to update ChatInputPart state before updating viewmodel (#299119)

This commit is contained in:
Don Jayamanne
2026-03-04 17:10:14 +11:00
committed by GitHub
parent b16ecea615
commit f4e743c4ab

View File

@@ -1924,10 +1924,13 @@ export class ChatWidget extends Disposable implements IChatWidget {
this._codeBlockModelCollection.clear();
this.viewModel = this.instantiationService.createInstance(ChatViewModel, model, this._codeBlockModelCollection, undefined);
// Set the input model on the inputPart before assigning this.viewModel. Assigning this.viewModel
// fires onDidChangeViewModel, which ChatInputPart listens to and expects the input model to be initialized.
// Pass input model reference to input part for state syncing
this.inputPart.setInputModel(model.inputModel, model.getRequests().length === 0);
this.viewModel = this.instantiationService.createInstance(ChatViewModel, model, this._codeBlockModelCollection, undefined);
this.listWidget.setViewModel(this.viewModel);
if (this._lockedAgent) {