From 8d864503e1d96ad37e2c4b001b330a75b03261cb Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 3 Feb 2026 07:07:33 +0100 Subject: [PATCH] Agent session list collapsed automatically without interaction (fix #291701) (#292472) --- .../browser/agentSessions/agentSessionsControl.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts index 5312ecd1529..f30cf4c4712 100644 --- a/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts +++ b/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl.ts @@ -18,6 +18,7 @@ import { ICommandService } from '../../../../../platform/commands/common/command import { ACTION_ID_NEW_CHAT } from '../actions/chatActions.js'; import { Event } from '../../../../../base/common/event.js'; import { Disposable } from '../../../../../base/common/lifecycle.js'; +import { Throttler } from '../../../../../base/common/async.js'; import { ITreeContextMenuEvent } from '../../../../../base/browser/ui/tree/tree.js'; import { MarshalledId } from '../../../../../base/common/marshallingIds.js'; import { Separator } from '../../../../../base/common/actions.js'; @@ -67,6 +68,8 @@ export class AgentSessionsControl extends Disposable implements IAgentSessionsCo private sessionsList: WorkbenchCompressibleAsyncDataTree | undefined; private sessionsListFindIsOpen = false; + private readonly updateSessionsListThrottler = this._register(new Throttler()); + private visible: boolean = true; private focusedAgentSessionArchivedContextKey: IContextKey; @@ -178,13 +181,13 @@ export class AgentSessionsControl extends Disposable implements IAgentSessionsCo this._register(this.options.filter.onDidChange(async () => { if (this.visible) { this.updateSectionCollapseStates(); - list.updateChildren(); + this.update(); } })); this._register(model.onDidChangeSessions(() => { if (this.visible) { - list.updateChildren(); + this.update(); } })); @@ -347,7 +350,7 @@ export class AgentSessionsControl extends Disposable implements IAgentSessionsCo } async update(): Promise { - await this.sessionsList?.updateChildren(); + return this.updateSessionsListThrottler.queue(async () => this.sessionsList?.updateChildren()); } setVisible(visible: boolean): void { @@ -358,7 +361,7 @@ export class AgentSessionsControl extends Disposable implements IAgentSessionsCo this.visible = visible; if (this.visible) { - this.sessionsList?.updateChildren(); + this.update(); } }