When archiving active session, clear it (#303684)

This commit is contained in:
Rob Lourens
2026-03-20 22:23:12 -07:00
committed by GitHub
parent 55969564bb
commit 9d7d0363de

View File

@@ -13,6 +13,7 @@ import { Event } from '../../../../../../base/common/event.js';
import { MutableDisposable, toDisposable, DisposableStore } from '../../../../../../base/common/lifecycle.js';
import { MarshalledId } from '../../../../../../base/common/marshallingIds.js';
import { autorun, IReader } from '../../../../../../base/common/observable.js';
import { isEqual } from '../../../../../../base/common/resources.js';
import { URI } from '../../../../../../base/common/uri.js';
import { localize } from '../../../../../../nls.js';
import { MenuWorkbenchToolBar } from '../../../../../../platform/actions/browser/toolbar.js';
@@ -628,6 +629,16 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
}
}));
// When the currently displayed session is archived, start a new session
this._register(this.agentSessionsService.model.onDidChangeSessionArchivedState(e => {
if (e.isArchived()) {
const currentSessionResource = chatWidget.viewModel?.sessionResource;
if (currentSessionResource && isEqual(currentSessionResource, e.resource)) {
this.clear();
}
}
}));
// When showing sessions stacked, adjust the height of the sessions list to make room for chat input
this._register(autorun(reader => {
chatWidget.inputPart.height.read(reader);